PDA

View Full Version : MBeanServer startup confusion


NickCotter
Aug 18th, 2005, 09:22 AM
Hi,

I'm running into some confusion trying to export my MBeans into an MBean server instance. This is all running under tomcat 4.1

The MBeans themselves appear to be fine, but I appear to be able to either create 2 MBean servers or none at all!

If I use the following context:

<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactory Bean"/>

<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="bean:name=testMBean1">
<ref bean="testMBean" />
</entry>
</map>
</property>
<property name="server">
<ref bean="mbeanServer" />
</property>
</bean>


I get this warning in the logs:

2005-08-18 13:12:22,343 [main] WARN org.springframework.jmx.support.JmxUtils - Found more than one MBeanServer instance. Returning first from list.


However, if I don't start an mbean server, ie I use the example in the reference documentation:

(http://static.springframework.org/spring/docs/1.2.x/reference/jmx.html#jmx-exporting)

<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="bean:name=testMBean1">
<ref bean="testMBean" />
</entry>
</map>
</property>
</bean>

I get an error, as it can no longer find any mbean servers:

org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'exporter' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.jmx.MBeanServerNotFoundExcepti on: Unable to locate an MBeanServer instance
org.springframework.jmx.MBeanServerNotFoundExcepti on: Unable to locate an MBeanServer instance....


Now I don't know much about tomcat's mbean abilities- especially version 4.1's - is the mysterious other mbean server from tomcat?


Thanks for any help,

Nick Cotter

robh
Aug 19th, 2005, 09:30 AM
Nick,

What VM are you running on? It seems that you would get 0 or 2 MBeanServers :)

Rob

Costin Leau
Aug 25th, 2005, 03:24 AM
I had similar problems in the past especially with JDK 1.5 where it's possible to make the VM start it's own server. First of all make sure you don't start teh server through the JDK, then check out your tomcat configuration - I think tomcat 4.1 also has some ways of creating the server.
Most likely you are using jdk 1.5 which starts it's own server that creates the conflict.