Announcement Announcement Module
Collapse
No announcement yet.
MBean not showing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MBean not showing

    Hi,

    I defined a JBoss SAR that creates a ClassPathXmlApplicationContext based on three files: 1.xml, 2.xml, 3.xml.

    In 1.xml, I define this:

    <bean id="jmxExporter" class="org.springframework.jmx.export.MBeanExporte r" lazy-init="false">
    <property name="autodetect" value="true" />
    <property name="assembler">
    <bean class="org.springframework.jmx.export.assembler.Me tadataMBeanInfoAssembler">
    <property name="attributeSource" ref="jmxAttributeSource" />
    </bean>
    </property>
    <property name="namingStrategy">
    <bean class="org.springframework.jmx.export.naming.Metad ataNamingStrategy">
    <property name="attributeSource" ref="jmxAttributeSource" />
    </bean>
    </property>
    </bean>

    <bean id="jmxAttributeSource" class="org.springframework.jmx.export.annotation.A nnotationJmxAttributeSource"/>

    In both 1.xml and 2.xml, I define beans having @ManagedResource annotation.

    MBeans defined in 1.xml are showing, but those in 2.xml are not.

    Has anyone an idea about what's wrong?

    Regards,

    J-F

  • #2
    More readable config

    Code:
    <bean id="jmxExporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false">
      <property name="autodetect" value="true" /> 
      <property name="assembler">
        <bean class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
          <property name="attributeSource" ref="jmxAttributeSource" /> 
        </bean>
      </property>
      <property name="namingStrategy">
        <bean class="org.springframework.jmx.export.naming.MetadataNamingStrategy">
          <property name="attributeSource" ref="jmxAttributeSource" /> 
        </bean>
      </property>
    </bean>
    
    <bean id="jmxAttributeSource" class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource"/>

    Comment


    • #3
      Beans cannot be embedded

      OK, I have found the problem.

      It appears that beans cannot be embedded such as
      Code:
      <bean id="myBean" class="...">
        <property name="theDependency">
          <bean class="ClassThatMustBeExported"/>
        </property>
      </bean>
      The instance of ClassThatMustBeExported must be declared in a separate top-level bean clause.

      The fact that exporter was defined in one file and the bean in another is irrelevant.

      J-F

      Comment

      Working...
      X