Announcement Announcement Module
Collapse
No announcement yet.
Cannot start JMXConnectorServer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot start JMXConnectorServer

    While trying to use Spring JMX on Java SE 5.0 as follows:
    Code:
    final MBeanServer mbs = (MBeanServer) context.getBean("mbeanServer");
    
    		final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/server");
    
    		final JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
    
    		cs.start();
    I encountered an exception "java.io.IOException: Cannot bind to URL [rmi://localhost:1099/server]" with this bottom cause:
    Code:
    Caused by: java.lang.ClassNotFoundException: javax.management.remote.rmi.RMIServerImpl_Stub (no secu
    rity manager: RMI class loader disabled)
    	at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:371)
    	at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
    	at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
    	at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
    	at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)
    	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
    	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
    	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
    	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
    	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
    	... 9 more
    Relevant config is as follows:

    Code:
    <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean" />
    
    	<!-- exports the beans with the assembler -->
    	<bean id="jmxAdapter" class="org.springframework.jmx.export.MBeanExporter">
    		<property name="beans">
    			<map>
    				<entry key="mx4j:name=httpAdaptor">
    					<ref local="httpAdaptor" />
    				</entry>
    				<entry key="mx4j:name=xsltProcessor">
    					<ref local="xsltProcessor" />
    				</entry>
    				<entry key="bean:name=threadAdmin">
    					<ref local="threadAdmin" />
    				</entry>
    			</map>
    		</property>
    		<property name="server">
    			<ref local="mbeanServer" />
    		</property>
    		<property name="assembler">
    			<ref bean="assembler" />
    		</property>
    	</bean>
    I expect I am missing something in the config or code, but I don't know what.

  • #2
    Do You Have an RMI Registry Running?

    Have you started an RMI registry? If you have not instructed Spring to start an RMI registry for you and if you have not started an RMI registry externally explicitly with the rmiregistry command, than you need to do so.

    The blog entry Spring, JMX, RMI, and depends-on covers how to specify that Spring create an RMI registry and associate it with your MBean server connector. The Spring 2.5 Reference also covers how to explicitly specify an RMI registry is running via Spring. If you would rather run the RMI registry externally from Spring, you can use the rmiregistry command as described here for Windows and here for Linux/Unix.

    Comment


    • #3
      What if I have two different MBean servers?

      If I have two MBean servers (and hence two distinct service URLs),
      do I need to define two separate registries?

      Eg: if I have two webapp contexts in Tomcat, say, appA and appB.
      appA exposes an MBean server at URL

      value="service:jmx:rmi://localhost/jndi/rmi://localhost:1091/appA

      and appB exposes an MBean server at URL

      value="service:jmx:rmi://localhost/jndi/rmi://localhost:1092/appB

      do I need to define two RMI registries?

      Thanx,

      /Ur

      Comment

      Working...
      X