Announcement Announcement Module
Collapse
No announcement yet.
MalformedObjectNameException: Unterminated key property part Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MalformedObjectNameException: Unterminated key property part

    Hi,

    I have a problem with registring beans in the rmiregistry. I am using Spring 2.1, Java 1.6, Tomcat 5.5 and all on windows xp.

    I have the following JMX related spring setup

    Code:
    	<bean id="registry"
    		class="org.springframework.remoting.rmi.RmiRegistryFactoryBean">
    		<property name="port" value="1099" />
    	</bean>
    
    	<bean id="serverConnector"
    		class="org.springframework.jmx.support.ConnectorServerFactoryBean"
    		depends-on="registry">
    		<property name="objectName" value="connector:name=rmi" />
    		<property name="serviceUrl"
    			value="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/myconnector" />
    	</bean>
    
    	<bean id="exporter"
    		class="org.springframework.jmx.export.MBeanExporter"
    		lazy-init="false">
    		<property name="autodetect" value="true" />
    		<property name="beans">
    			<map>
    				<entry key="bean:testBean1" value-ref="userService" />
    			</map>
    		</property>
    		<!-- property name="server">
    			<bean class="platform.package.MBeanServerLocator"
    				factory-method="locateMBeanServer" />
    		</property -->
    	</bean>
    I first start an rmiregistry by hand (the one spring starts is too slow and I get a ConnectException).
    Then the MalformedObjectNameException: Unterminated key property part appears, as spring tries to export the MBean "userService" to the registry.

    (If i leave the line <property name="autodetect" value="true" /> away, no exception is thrown, but also none of my MBean's appear in JConsole.)

    Here is the trace:

    Code:
     [java] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exporter' defined in class path resource [/spring/live/jmx.spring.xml]: Invocation of init method failed; nested exception is org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [comauth.service.impl.UserService@88d319] with key 'myconnector:testBean1'; nested exception is javax.management.MalformedObjectNameException: Unterminated key property part
         [java] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1306)
         [java] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:532)
         [java] 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:238)
         [java] 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:167)
         [java] 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:235)
         [java] 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:167)
         [java] 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:385)
         [java] 	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:730)
         [java] 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369)
         [java] 	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:245)
         [java] 	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188)
         [java] 	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
         [java] 	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
         [java] 	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
         [java] 	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
         [java] 	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
         [java] 	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
         [java] 	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
         [java] 	at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
         [java] 	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
         [java] 	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
         [java] 	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
         [java] 	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
         [java] 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
         [java] 	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
         [java] 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
         [java] 	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
         [java] 	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
         [java] 	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
         [java] 	at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
         [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         [java] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         [java] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         [java] 	at java.lang.reflect.Method.invoke(Method.java:597)
         [java] 	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
         [java] 	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
         [java] Caused by: org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [comauth.service.impl.UserService@88d319] with key 'myconnector:testBean1'; nested exception is javax.management.MalformedObjectNameException: Unterminated key property part
         [java] 	at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:594)
         [java] 	at org.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:502)
         [java] 	at org.springframework.jmx.export.MBeanExporter.afterPropertiesSet(MBeanExporter.java:395)
         [java] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1334)
         [java] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1303)
         [java] 	... 35 more
         [java] Caused by: javax.management.MalformedObjectNameException: Unterminated key property part
         [java] 	at javax.management.ObjectName.construct(ObjectName.java:540)
         [java] 	at javax.management.ObjectName.<init>(ObjectName.java:1394)
         [java] 	at javax.management.ObjectName.getInstance(ObjectName.java:1276)
         [java] 	at org.springframework.jmx.support.ObjectNameManager.getInstance(ObjectNameManager.java:74)
         [java] 	at org.springframework.jmx.export.naming.KeyNamingStrategy.getObjectName(KeyNamingStrategy.java:140)
         [java] 	at org.springframework.jmx.export.MBeanExporter.getObjectName(MBeanExporter.java:730)
         [java] 	at org.springframework.jmx.export.MBeanExporter.registerBeanInstance(MBeanExporter.java:643)
         [java] 	at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:584)
         [java] 	... 39 more
    I read all about JMX I could find, but nothing could hint me into the right direction.

    Any help appreciated...
    Regards Raoul

  • #2
    It looks like the bean mapping key in your MBeanExporter configuration is not a valid MBean ObjectName:

    Code:
    <entry key="bean:testBean1" value-ref="userService" />
    Try changing the key in this mapping to:

    Code:
    <entry key="bean:name=testBean1" value-ref="userService" />
    See here for more details on the format of JMX ObjectNames:

    http://java.sun.com/javase/6/docs/ap...bjectName.html

    Comment

    Working...
    X