Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-9288

JMX related failures in spring-context tests


    • Type: Task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2 M1
    • Fix Version/s: 3.2 RC2
    • Component/s: [Build]
    • Labels:
    • Last commented by a User:


      The failure occurs when I run all spring-context tests from the command line. It doesn't fail when running the test alone, the tests in the same package, or all tests inside Eclipse.

      The test creates an MBeanServer via javax.management.MBeanServerFactory, then tries to check if an MBeanServerFactoryBean will locate that same instance. The assertSame on line 65 fails because more than one MBeanServer instances were found and the first one returned was not the same instance.

      Running gradle in debug mode and using breakpoints in addMBeanServer() and removeMBeanServer() of MBeanServerFactory, I was able to find one case where an MBeanServer is added but not removed. It happens in AdvisedJRubyScriptFactoryTests inside JRuby itself when Spring tries to load a script via JRubyScriptFactory. So it looks like a side effect, which explains why the failure doesn't occur when running a single test but not why it doesn't fail inside Eclipse.

      I experimented with a tearDown() method in AdvisedJRubyScriptFactoryTests, which looks for and releases any MBeanServers it finds but that caused a failure in JmxUtilsTests.testLocatePlatformMBeanServer. So clearly not a good fix. Furthermore the fact this is an environment-sensitive issue makes even more hesitant to go any further.

        Issue Links


          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          241d 5h 2m 1 Phil Webb 26/Nov/12 3:53 PM
          Resolved Resolved Reopened Reopened
          2d 21h 43m 1 Phil Webb 29/Nov/12 1:37 PM
          Reopened Reopened Resolved Resolved
          1h 11m 1 Phil Webb 29/Nov/12 2:48 PM


            • Assignee:
              pwebb Phil Webb
              rstoya05-aop Rossen Stoyanchev
              Last updater:
              Phil Webb
            • Votes:
              1 Vote for this issue
              5 Start watching this issue


              • Created:
                Days since last comment:
                5 years, 13 weeks, 1 day ago