Announcement Announcement Module
Collapse
No announcement yet.
MBeanServerNotFoundException - how to configure for both tomcat & unit tests Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MBeanServerNotFoundException - how to configure for both tomcat & unit tests

    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:

    Code:
    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

  • #2
    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).

    Comment


    • #3
      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?

      Comment


      • #4
        Make sure you start the JDK 1.5 with JMX (by default it's turned off):
        -Dcom.sun.management.jmxremote
        See 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.

        Comment

        Working...
        X