Announcement Announcement Module
Collapse
No announcement yet.
MetadataMBeanInfoAssembler does not work - Bitte Hilfe! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MetadataMBeanInfoAssembler does not work - Bitte Hilfe!

    Env: JDK1.6, Spring 2.5.1

    I am using MetadataMBeanInfoAssembler and I find that the beans
    are not exposed when I query via MC4J (1.2 beta 9):

    Code:
     <bean
    	  id="MyMBeanServer"
    	  class="org.springframework.jmx.support.MBeanServerFactoryBean"
              
              p:defaultDomain="${my.domain}"
    	/>
    	
    	<context:mbean-export server="MyMBeanServer" default-domain="${my.domain}"/>
    	  
    
        <bean 
           id="MyMBeanAttributeSource"
           class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource"
         />
    
       
        <bean 
           id="MyMBeanAssembler"
           class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler"
    
             p:attributeSource-ref="MyMBeanAttributeSource"
        />
    
       
        <bean 
           id="MyMBeanNamingStrategy"
           class="org.springframework.jmx.export.naming.MetadataNamingStrategy"
    
             p:attributeSource-ref="MyMBeanAttributeSource"
        />
    
      
        <bean
    	  id="MyMBeanExporter"
    	  class="org.springframework.jmx.export.MBeanExporter"
    
    	    p:assembler-ref="MyMBeanAssembler"
    	    p:autodetectModeName="AUTODETECT_ASSEMBLER"
    	    p:namingStrategy-ref="MyMBeanNamingStrategy"
            p:registrationBehaviorName="REGISTRATION_FAIL_ON_EXISTING"
            p:server-ref="MyMBeanServer"
    	/>
    Here is a sample POJO that I a attempt to export:

    Code:
    package com.xxx.foo;
    
    @ManagedResource(objectName="MyDomain:name=MyStatus", description="My status")
    public class MyStatus implements Serializable { ... }
    I am running this code in tomcat 6.0.x. When I connect to the service
    URL, I see Tomcat-exported MBeans but I do not see
    MBean "MyDomain:name=MyStatus".

    Is there anything I am missing above that makes MetadataMBeanInfoAssembler not do its function?

    Any help greatly appreciated!

    Thanx,

    /U

  • #2
    When I turn on the debugs of org.springframework.jmx.export.MBeanExporter, I get the following:

    Code:
    2008-01-26 17:02:37.0880 INFO  org.springframework.jmx.export.MBeanExporter - Registering beans for JMX exposure on startup
    2008-01-26 17:02:38.0000 INFO  org.springframework.remoting.rmi.RmiRegistryFactoryBean - Looking for RMI registry at port '9999'
    2008-01-26 17:02:38.0020 WARN  org.springframework.jmx.support.JmxUtils - Found more than one MBeanServer instance. Returning first from list.
    It appears that MBeanExporter did not get my @ManagedResources tagged
    POJOs from the assembler. How can I troubleshoot this further?

    I also notice this:

    Code:
    2008-01-26 17:02:38.0020 WARN  org.springframework.jmx.support.JmxUtils - Found more than one MBeanServer instance. Returning first from list.
    I instantiate my own MBean Server and Tomcat has its own.
    I assume that this would cause a conflict since both the servers
    would be used in the agent. The message above, suggests that
    the "first one" was picked. How could I tell on which MBean server
    was selected?

    Thanks,

    /U

    Comment


    • #3
      I've a similar problem with Spring 2.5, Tomcat 5.5.26. Both bring up an mbean server instance, the 1st is used and with jconsoel I can see all the Catalina mbeans but none of my @ManagedResources.

      How can I disable the tomcat mbeanserver? Alternatively how can I pusblish all my spring beans to the tomcat instance and not the local one?

      TIA,

      -s

      Comment


      • #4
        Try setting the 'locateExistingServerIfPossible' property to true. That way the factorybean will first try to locate any existing servers and act as a wrapper around that.

        Also if you don't specify the MBeanServerFactoyBean bean and only a exporter beans will automatically be registered in the available MBean server.

        If you would use Spring 2.5.2

        Code:
        <context:mbean-export/>
        That is all you should need, no MBeanServerFactoryBean, no additional configuration. That should do it.
        Last edited by Marten Deinum; Mar 22nd, 2008, 03:48 AM.

        Comment


        • #5
          Thanks Marten,

          the 'locateExistingServerIfPossible' did the trick!

          Much appreciated.

          Comment

          Working...
          X