PDA

View Full Version : Must specify at least one bean for registration



loge
Sep 19th, 2006, 05:04 PM
Hi,

i am getting the error as mentioned in the subject even though i am in JDK5 annotations mode. Here is the wiring:



<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="assembler">
<bean class="org.springframework.jmx.export.assembler.MetadataM BeanInfoAssembler">
<property name="attributeSource" ref="jmxAttributeSource"/>
</bean>
</property>
<property name="namingStrategy">
<bean class="org.springframework.jmx.export.naming.MetadataNami ngStrategy">
<property name="attributeSource" ref="jmxAttributeSource"/>
</bean>
</property>
<property name="autodetect" value="true"/>
</bean>

<bean id="jmxAttributeSource"
class="org.springframework.jmx.export.annotation.Annotati onJmxAttributeSource"/>


Then i have annotated one of my existing beans with the annotations as shown in the spring doc. The only difference is that my bean doesnt implement an interface like the example bean in your docs.

Why cant the exporter find my bean?

Logging on jmx channel on trace level only revealed this:

[DEBUG 00:17:47] JmxUtils.locateMBeanServer(92) | Found MBeanServer: com.sun.jmx.mbeanserver.JmxMBeanServer@210e81
[INFO 00:17:47] MBeanExporter.registerBeans(348) | Autodetecting user-defined JMX MBeans

Thanks for insights how to get more infos on that issue or for plain solutions to this ;)

Marc

loge
Sep 20th, 2006, 12:06 PM
I partially found the problem. Its definitely my bean to be exposed that makes problem. A very simple annotated POJO works like a charm. I assume the problem was that my former bean is a proxy itself and i somewhere read that JDK proxies dont work. No matter what, i am using my simple Pojo here and inject it with various services to get system informations. That will do it too.

loge
Sep 21st, 2006, 07:25 AM
For all who are interessted, i wrote my experiences with Spring and JMX down (in my blog) and added an advanced dynamic bean example into it too.

Read it here (http://www.logemann.org/blojsom/blog/default/2006/09/21/Simple-MBeans-dynamic-MBeans-and-Spring.html).

Now this monologue really ends :)