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:
lt;bean id=quot;jmxExporterquot; class=quot;org..jmx.export.MBeanExporte rquot; lazy-init=quot;falsequot;gt; lt;property name=quot;autodetectquot; value=quot;truequot; /gt; lt;property name=quot;assemblerquot;gt; lt;bean class=quot;org..jmx.export.assembler.Me tadataMBeanInfoAssemblerquot;gt; lt;property name=quot;attributeSourcequot; ref=quot;jmxAttributeSourcequot; /gt; lt;/beangt; lt;/propertygt; lt;property name=quot;namingStrategyquot;gt; lt;bean class=quot;org..jmx.export.naming.Metad ataNamingStrategyquot;gt; lt;property name=quot;attributeSourcequot; ref=quot;jmxAttributeSourcequot; /gt; lt;/beangt; lt;/propertygt;
lt;/beangt;
lt;bean id=quot;jmxAttributeSourcequot; class=quot;org..jmx.export.annotation.A nnotationJmxAttributeSourcequot;/gt;
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
Code:
lt;bean id=quot;jmxExporterquot; class=quot;org..jmx.export.MBeanExporterquot; lazy-init=quot;falsequot;gt; lt;property name=quot;autodetectquot; value=quot;truequot; /gt; lt;property name=quot;assemblerquot;gt; lt;bean class=quot;org..jmx.export.assembler.MetadataMBeanInfoAssemblerquot;gt; lt;property name=quot;attributeSourcequot; ref=quot;jmxAttributeSourcequot; /gt; lt;/beangt; lt;/propertygt; lt;property name=quot;namingStrategyquot;gt; lt;bean class=quot;org..jmx.export.naming.MetadataNamingStrategyquot;gt; lt;property name=quot;attributeSourcequot; ref=quot;jmxAttributeSourcequot; /gt; lt;/beangt; lt;/propertygt;
lt;/beangt;
lt;bean id=quot;jmxAttributeSourcequot; class=quot;org..jmx.export.annotation.AnnotationJmxAttributeSourcequot;/gt;OK, I have found the problem.
It appears that beans cannot be embedded such as
Code:
lt;bean id=quot;myBeanquot; class=quot;...quot;gt; lt;property name=quot;theDependencyquot;gt; lt;bean class=quot;ClassThatMustBeExportedquot;/gt; lt;/propertygt;
lt;/beangt;
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 |