Announcement Announcement Module
Collapse
No announcement yet.
MalformedURL on MBeanServerConnectionFactoryBean creation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MalformedURL on MBeanServerConnectionFactoryBean creation

    Using Spring 2.0.4 in a command line application (no embedded JMX support), I'm trying to follow the documentation as closely as possible in setting up JMX.

    The problem I'm running into is the following exception.

    Code:
    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmxClientConnector' defined in class path resource [spring.jmx.connector.p2pgames-server-admin.xml]: Invocation of init method failed; nested exception is java.net.MalformedURLException: URL path must begin with /jndi/ or /stub/ or /ior/: 
    Caused by: java.net.MalformedURLException: URL path must begin with /jndi/ or /stub/ or /ior/: 
    	at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1795)
    	at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:259)
    	at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
    	at org.springframework.jmx.support.MBeanServerConnectionFactoryBean.connect(MBeanServerConnectionFactoryBean.java:126)
    	at org.springframework.jmx.support.MBeanServerConnectionFactoryBean.afterPropertiesSet(MBeanServerConnectionFactoryBean.java:114)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1175)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1145)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:144)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:276)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:360)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
    	at p2p.etc.spring.SpringSupport.init(SpringSupport.java:50)
    	at p2p.server.GameServerControlsTestCmd.main(GameServerControlsTestCmd.java:16)
    The configuration in question is the following bean.

    Code:
       <bean id="jmxClientConnector" class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean">
          <property name="serviceUrl" value="service:jmx:rmi://localhost:9875"/>
       </bean>
    For informational purposes, the server is defined as follows.

    Code:
      <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"/>
    I am following the example given within the documentation available at http://static.springframework.org/sp...rence/jmx.html in section 20.5.

    I've tried different settings within the serviceUrl to no avail.

    Any help appreciated.
    Last edited by lukasbradley; May 2nd, 2007, 04:27 PM.

  • #2
    For those interested, this is what I had to do.

    Make sure an instance of the RMI Registry has been defined within Spring, if you are using that communication format. There is no example of this in the documentation, and was my major stumbling block. I thought the documentation inferred that Spring would start one if not explicitly defined.

    Code:
    <bean id="rmiRegistry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean">
       <property name="port" value="9666"/>
    </bean>
    Second, use the port above in your connection URL.

    Code:
       <bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean">
         <property name="objectName" value="connector:name=rmi"/>
         <property name="serviceUrl" value="service:jmx:rmi:///jndi/rmi://192.168.2.100:9666/server"/>
         <property name="server" ref="mbeanServer"/>
       </bean>
    I'm still learning as I go here, so I hope it helps if anyone trips where I did.

    Comment

    Working...
    X