getting RMI JMX Server Stub from wihin a tomcat MBean itself

Hello,

to my environment:

- java 1.5

- tomcat 5.5

i am trying to access remote mbeans from my web-app instances running on different machines for some clustering purpose. in general i am trying to access the oher remote mbeans from within a mbean itself using a rmi stub wrapped in some kind of a jmx server class like this:

class JMXServer{

String name;

String host;

String port;

private SystemAccessMBean systemAccess;// the remotes mbean inerface

...

JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"+this.host+":"+this.port+"/jmxrmi");

JMXConnector jmxc = JMXConnectorFactory.connect(url, null);

MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();

ObjectName mbeanName = new ObjectName(SystemAccessMBean.NAME);

this.systemAccess = SystemAccessMBean)MBeanServerInvocationHandler.newProxyInstance(mbsc, mbeanName, SystemAccessMBean.class, false);

...

}

the problem is that when i try to use this code outside the tomcat context it works fine but from wihin this mbean in tomcat it causes troubles:

...

java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.naming.java.javaURLContextFactory [Root exception is java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory]

[exec]at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:317)

[exec]at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)

...

i found the missing classes in tomcat/common/lib/naming-factory.jar . however i do not know where to include this right (tried several locaions) nor what this class is all about or what i am probably misunderstanding here. the purpose of all this is that i want to get some of my mbeans working with each other on different machines using rmi stubs.

1) how do i get around the error ?

2) is this approach useful ?

thanks in advance for your help,

Michael

[2118 byte] By [mwilligensa] at [2007-11-27 9:00:58]
# 1
Same Problem here, is there no solution for that?
Laemmerta at 2007-7-12 21:30:13 > top of Java-index,Core,Core APIs...