ConversionNotSupportedException encountered when deploying a Spring MBeanExporter in JBoss

Solution Verified - Updated -

Issue

  • I have a JMX-enabled bean which fails to initialize on JBoss. The bean is  configured using the Spring Framework MBeanExporter which uses the JBoss class MBeanServerLocator, method locateJBoss to find the JMX server,

    <bean id="mbeanServer" class="org.jboss.mx.util.MBeanServerLocator" factory-method="locateJBoss"/>
    <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false">
     <property name="beans">
       <map>
         <entry key="bean:name=SomeService" value-ref="waitTimesService"/>
       </map>
     </property>
    
  • During deployment the following error is encountered:

    ERROR [ContextLoader] Context initialization failed
     org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exporter' 
     defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; 
     nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert 
     property value of type 'org.jboss.mx.server.MBeanServerImpl' to required type 'javax.management.MBeanServer' 
     for property 'server'; nested exception is java.lang.IllegalStateException: Cannot convert value of 
     type [org.jboss.mx.server.MBeanServerImpl] to required type [javax.management.MBeanServer] for property
     'server': no matching editors or conversion strategy found
    
  • It would seem the locateJBoss method is not returning an instance of javax.management.MBeanServer.

Environment

  • JBoss Enterprise Application Platform (EAP) 5.0
  • Spring 3.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content