Connector issues

2005-06-22 Thread Slobodan Vujasinovic
Hi,

we, in Enhydra Development Team, have a little problem with Tomcat 5.5.9 
administration.

There are some Connector issues that I want to point out here.

1. In new Enhydra 6.4-1 (based on Tomcat 5.5.9) we are enabling secure SSL HTTP 
Connector initialization (default connector configuration present in 
'server.xml' configuration file with adaptable port setting). This part is 
working great!

But, when we try to administer installed Tomcat through its 'admin' application 
(change something in server configuration and commit changes) SSL HTTP 
connector configuration gets corrupted. All connector parameters are saved 
except 'sslProtocol' attribute setting which is not saved (I presume) because 
of its default value (TLS). On server restart (when there is no 'sslProtocol' 
parameter defined) SSL HTTP connector is initialized (without any exception - 
OK) but isn't functional any more and 'admin application - SSL HTTP Connector - 
SSL Protocol' parameter setting is empty. 
 
Tomcat documentation is saying that 'sslProtocol' parameter is not obligate 
(default value is TLS) but it's a bit different in practice (must be some bug 
in HTTP connector-protocol initialization).

I've tried to find the cause of the problem in Tomcat source code!

It seems that problem can be resolved with simple implementation change in 
'org.apache.catalina.connector.Connector' class

   /**
 * Set the secure connection flag that will be assigned to requests
 * received through this connector.
 *
 * @param secure The new secure connection flag
 */
public void setSecure(boolean secure) {

this.secure = secure;
   
   // additionally set 'secure' ProtocolHandler property trough 
IntrospectionUtils class
   setProperty(secure, String.valueOf(secure));

}

This code adaptation seems to be working for me. I didn't manage to test this 
(my spare time is very limited) heavily but I hope that someone will take some 
time to look into this.

2. We (in Enhydra) have 'Enhydra Director'  - web server plug-in for Apache, 
IIS and IPlanet supporting advanced load balancing, clustering and runtime 
administration. 

To enable communication between Tomcat and 'Director' we have our own protocol 
implementation ('Enhydra Director Protocol').
When we add director-protocol implementation (binary) to Tomcat and (manually) 
insert additional (Director) Connector configuration in 'server.xml' file 
everything is working (perfect).

But, there is a question of runtime creation and reconfiguration (like for 
other HTTP and AJP protocol implementations).
We adapted original Tomcat Admin application (few simple implementation 
changes) and 'org.apache.catalina.mbeans.MBeanFactory' (implemented creation of 
Director connector) Tomcat class together with 'mbeans-decriptors.xml' file.

Is there a way to enable creation and configuration of custom connector 
(protocol) implementations during server runtime in predefined (elegant) 
manner? 
I don't want to patch original Tomcat binaries!


Regards,
 Slobodan Vujasinovic
Enhydra Development Team

 


Tomcat Admin

2005-01-11 Thread Slobodan Vujasinovic
I'm Running Tomcat With J2SE Version 1.4 (j2se1.4.2_03) and I've
integrated standalone admin package in existing Tomcat (version 5.5.4)
installation.

Everything seems to work just fine (managed to start and login into
application)! The only problem is that I can't access and administer
Hosts and their Contexts for Catalina Service through present 'Tree
Control Frame'. 

I'm used to this administration feature (previously using Tomcat
5.0.30).

Is this expected behavior for admin application or there is something
else (maybe some additional configuration) to be done?

Regards,
Slobodan



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tomcat and JMX (JRMP)!

2004-07-19 Thread Slobodan Vujasinovic
I'm member of 'Enhydra Development Team' and we are currently developing
Application Server (Enhydra-Lite) based on Tomcat5.0.

I'm developing a side tool (EnTray - system tray administration tool (used
for starting/stopping server actions, accessing deployed applications, etc))
that communicates with Tomcat (its MBeanServer) using JMX and gathers
information from/about registered MBeans.



As I understood Tomcat 5.0.x offers possibility of Complete server
monitoring using JMX and the manager web application which is OK (I
downloaded jmx.browser-1.2.0 application from Source Forge which enabled
me to se all registered MBeans).



But, I need to establish communication with Tomcat thru rmi/jrmp protocol
(from diferent virtual mashine).

I stumbled upon some configuration parameters on JK2 Home Page (
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk2/configweb.html).

Parameters are:  mx.enable, mx.httpPort, mx.httpHost, mxjrmpPort (probably
typing error, I assume mx.jrmpHost is meant to be here) and mx.jrmpPort.

After integration of mx4j (2.0.1 release) into Tomcat I had no problems
with communication thro HTTP, but JRMP could not be initialized because
class mx4j.adaptor.rmi.jrmp.JRMPAdaptor was not found (probably some older
mx4j implementation - in new versions this class is placed in
mx4j.tools.adaptor.rmi.jrmp package). I even stumbled, on tomcat users
mailing list, on some additional configuration parameters (!!???) that
enable configuration of Adapter classes that are going to be initialized
(mx.mx4jHttpAdaptorClassName and mx.mx4jJRMPAdaptorClassName), but that
didn't work eider.

After, repackaging of JRMPAdaptor (from mx4j.adaptor.rmi.jrmp to
mx4j.tools.adaptor.rmi.jrmp) I've succeeded to establish communication
between EnTray and Tomcat, and everything looked just fine - until I tried
to shutdown the server.

I've got Stoping JMX log on console and server could not finish shutdown
process.

To resolve this problem I had to take a look at Tomcats source code
(downloaded actual release 5.0.27) and found class of my interest
(org.apache.jk.common.JkMX - placed in 'jakarta-tomcat-connectors'
module).

Problem was in destroy() method where You are trying to stop
jrmpServerName (mx4j.tools.naming.NamingService) and not

actually initialized adaptor (mx4j.adaptor.rmi.jrmp.JRMPAdaptor).

Fatherly, I' ve changed JRMAdaptor initialization (in the same class) by
adding mx4j.tools.adaptor.rmi.jrmp.JRMPAdaptor (latest implementation of
mx4j) implementation option (mx4j.tools.adaptor.http.HttpAdaptor and
mx4j.adaptor.http.HttpAdaptor options already existed there).



I'm sending adapted JkMX.java file (org.apache.jk.common.JkMX
implementation) and I hope that You will be so kind to consider those
changes and to include them in next Tomcat release (I understand that This
is very experimental - but is the matter of great importance to me).



Regards,

Slobodan Vujasinovic

Enhydra Development Team


/*
 *  Copyright 1999-2004 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the License);
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an AS IS BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.apache.jk.common;


import org.apache.jk.core.JkHandler;

import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.Attribute;
import javax.management.MBeanServerFactory;
import java.io.IOException;

/**
 * Load the HTTP or RMI adapters for MX4J and JMXRI.
 *
 * Add mx.enabled=true in jk2.properties to enable it.
 * You could also select http and/or jrmp protocol, 
 * with mx.httpPort, mx.httpHost, mxjrmpPort and mx.jrmpPort
 *
 */
public class JkMX extends JkHandler
{
MBeanServer mserver;
private boolean enabled=false;
private int httpport=-1;
private String httphost=localhost;
private int jrmpport=-1;
private String jrmphost=localhost;
private boolean useXSLTProcessor = true;

public JkMX() {
}

/*  Public methods  */

/** Enable the MX4J adapters (new way)
 */
public void setEnabled(boolean b) {
enabled=b;
}

public boolean getEnabled() {
return enabled;
}

/** Enable the MX4J adapters (old way, compatible)
 */
public void setPort(int i) {
enabled=(i != -1);
}

public int getPort() {
return ((httpport != -1) ? httpport : jrmpport);
}

/** Enable the MX4J HTTP internal adapter
 */ 
public void setHttpPort( int i ) {
httpport=i