Results 1 to 4 of 4

Thread: MBeanServerNotFoundException - how to configure for both tomcat & unit tests

  1. #1

    Default 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. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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).
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Dec 2004
    Posts
    8

    Default

    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?

  4. #4
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •