View Full Version : MBeanServerNotFoundException - how to configure for both tomcat & unit tests
cunparis
Apr 19th, 2006, 12:17 PM
I understand how to declare an mbean server in the spring conf, but I'm stuck on a point.. when I run my webapp I want to use the mbean server of tomcat. However when I run the unit tests, I get:
MBeanServerNotFoundException: Unable to locate an MBeanServer instance
So I need to tell spring to create an mbean server for the unit tests. I'm not sure how to do this with the conf, it seems to be one way or the other. Is it possible? How do most people handle this?
-Michael
Costin Leau
Apr 20th, 2006, 10:33 AM
see the jmx unit tests from the Spring package. You can use Spring test package to load and cache the application context in which you can add a jmx server that will be created only inside the test environment (usually by importing another xml file that declares it).
tweise
Jun 19th, 2006, 10:16 PM
I get MBeanServerNotFoundException when running unit tests on jdk 1.5. I would have expected the JVM own MBeanServer to be used, but it is not found. When loading the app context inside the JBoss container it works fine. Is there anythibg extra I have to do to resolve the 1.5 MBean server in the test setup?
Costin Leau
Jun 20th, 2006, 03:48 AM
Make sure you start the JDK 1.5 with JMX (by default it's turned off):
-Dcom.sun.management.jmxremoteSee the official docs for more options (i.e. how to start the server on a specific port and with ssl for example).
After starting the jvm, use jconsole to see if the JMX server was properly started.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.