Announcement Announcement Module
Collapse
No announcement yet.
JMX Sandbox with JBoss Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JMX Sandbox with JBoss

    Hi,
    i've tried to use the jmx package, which is in the sandbox, with jboss.
    When i give JmxMBeanAdapter a map of beans through it's "beans" property, it works fine
    <bean id="jmxAdapter" class="org.springframework.jmx.JmxMBeanAdapter">
    <property name="beans">
    <map>
    <entry key="bean:name=testBean1">
    <ref local="testBean"/>
    </entry>
    </map>
    </property>
    </bean>



    However, when i try to use MetadataModelMBeanInfoAssembler, i have an exception.

    My spring context is the following:
    <bean id="ehcacheMonitoring"
    class="mypackage.service.mbean.EHCacheMonitoring">
    </bean>

    <bean id="jmxAdapter"
    class="org.springframework.jmx.JmxMBeanAdapter"
    >
    <property name="assembler">
    <ref bean="metadataAssembler"/>
    </property>
    <property name="namingStrategy">
    <ref bean="metadataNaming"/>
    </property>
    </bean>

    <bean id="metadataAssembler"
    class="org.springframework.jmx.assemblers.metadata .MetadataModelMBeanInfoAssembler">
    <property name="attributeSource">
    <ref bean="attributesImpl"/>
    </property>
    </bean>

    <bean id="metadataNaming"
    class="org.springframework.jmx.naming.MetadataNami ngStrategy">
    <property name="attributeSource">
    <ref bean="attributesImpl"/>
    </property>
    </bean>

    <bean id="attributesImpl"
    class="org.springframework.jmx.metadata.support.co mmons.CommonsAttributesJmxAttributeSource"/>

    My bean is
    *
    * @@org.springframework.jmx.metadata.support.Managed Resource()
    */
    public class EHCacheMonitoring implements EHCacheMonitoringMBean
    {

    /**
    * @@org.springframework.jmx.metadata.support.Managed Operation()
    */
    public String showCachesInfo() throws CacheException
    {
    .....
    }

    }

    The exception is
    10:01:59,859 ERROR [ContextLoader] Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'jmxAdapter' defined in ServletContext resource [/WEB-INF/classes/serviceContext.xml]: Initialization of bean failed; nested exception is org.springframework.jmx.exceptions.MBeanAssemblyEx ception: A JMX error occured when trying to assemble the management interface metadata.; nested exception is javax.management.MBeanRegistrationException: preRegister() failed [ObjectName='spring:bean=EHCacheMonitoring', Class=javax.management.modelmbean.RequiredModelMBe an (javax.management.modelmbean.RequiredModelMBean@f1 b95f)]
    org.springframework.jmx.exceptions.MBeanAssemblyEx ception: A JMX error occured when trying to assemble the management interface metadata.; nested exception is javax.management.MBeanRegistrationException: preRegister() failed [ObjectName='spring:bean=EHCacheMonitoring', Class=javax.management.modelmbean.RequiredModelMBe an (javax.management.modelmbean.RequiredModelMBean@f1 b95f)]
    MBeanException: preRegister() failed [ObjectName='spring:bean=EHCacheMonitoring', Class=javax.management.modelmbean.RequiredModelMBe an (javax.management.modelmbean.RequiredModelMBean@f1 b95f)]
    Cause: java.lang.ClassCastException
    at org.jboss.mx.server.registry.BasicMBeanRegistry.re gisterMBean(BasicMBeanRegistry.java:160)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.jboss.mx.capability.ReflectedMBeanDispatcher.i nvoke(ReflectedMBeanDispatcher.java:284)
    at org.jboss.mx.interceptor.ObjectReferenceIntercepto r.invoke(ObjectReferenceInterceptor.java:59)
    at org.jboss.mx.interceptor.MBeanAttributeInterceptor .invoke(MBeanAttributeInterceptor.java:43)
    at org.jboss.mx.interceptor.PersistenceInterceptor2.i nvoke(PersistenceInterceptor2.java:93)
    at org.jboss.mx.server.MBeanInvoker.invoke(MBeanInvok er.java:76)
    at javax.management.modelmbean.RequiredModelMBean.inv oke(RequiredModelMBean.java:144)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:546)
    at org.jboss.mx.server.MBeanServerImpl.registerMBean( MBeanServerImpl.java:997)
    at org.jboss.mx.server.MBeanServerImpl.registerMBean( MBeanServerImpl.java:327)
    at org.springframework.jmx.JmxMBeanAdapter.registerSi mpleBean(JmxMBeanAdapter.java:295)
    at org.springframework.jmx.JmxMBeanAdapter.registerBe an(JmxMBeanAdapter.java:272)
    at org.springframework.jmx.JmxMBeanAdapter.registerBe ans(JmxMBeanAdapter.java:218)
    at org.springframework.jmx.JmxMBeanAdapter.afterPrope rtiesSet(JmxMBeanAdapter.java:117)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1037)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:305)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:223)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:236)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:159)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:261)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
    at org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(AbstractRef reshableWebApplicationContext.java:131)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:177)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:105)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 48)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3270)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:3599)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:821)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:807)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:579)
    at org.jboss.web.tomcat.tc4.EmbeddedTomcatService.cre ateWebContext(EmbeddedTomcatService.java:530)
    at org.jboss.web.tomcat.tc4.EmbeddedTomcatService.per formDeploy(EmbeddedTomcatService.java:309)
    at org.jboss.web.AbstractWebContainer.start(AbstractW ebContainer.java:428)
    at org.jboss.deployment.MainDeployer.start(MainDeploy er.java:832)
    at org.jboss.deployment.MainDeployer.deploy(MainDeplo yer.java:642)
    at org.jboss.deployment.MainDeployer.deploy(MainDeplo yer.java:605)
    at sun.reflect.GeneratedMethodAccessor22.invoke(Unkno wn Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.jboss.mx.capability.ReflectedMBeanDispatcher.i nvoke(ReflectedMBeanDispatcher.java:284)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:546)
    at org.jboss.jmx.adaptor.control.Server.invokeOpByNam e(Server.java:229)
    at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invo keOpByName(HtmlAdaptorServlet.java:266)
    at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.proc essRequest(HtmlAdaptorServlet.java:81)
    at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doGe t(HtmlAdaptorServlet.java:56)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.jboss.web.tomcat.security.JBossSecurityMgrReal m.invoke(JBossSecurityMgrRealm.java:220)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.valves.CertificatesValve.invok e(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.jboss.web.tomcat.tc4.statistics.ContainerStats Valve.invoke(ContainerStatsValve.java:76)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(St andardContext.java:2416)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.in voke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(SecurityAssociationValve.java:65)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:577)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(Co yoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:601)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:534)

    Any idea?

    Thanks.

    Jean

  • #2
    Jean,

    I'll take a look into this before we do the release. It looks like the error is thrown from JBoss (ClassCastException). It is possible that not all dependent classes are available on the classpath.

    It would be great if you could post a bug report on JIRA with sample code and information about the version of JIRA you are using. Please assign the issue to me.

    Regards,

    Rob

    Comment

    Working...
    X