Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-411

BasicManagedDataSource - unregister from JMX on close()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0
    • 2.0
    • None

    Description

      There is a JMX registration issue in TestBasicManagedDataSource.

      If the test is run with logging:

      mvn test -Dtest=TestBasicManagedDataSource -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog

      then lots of stack traces are shown as below.

      This appears to be because each name can only be registered once.

      Perhaps the test is flawed, and it should deregister the name in tearDown() ?
      However there does not seem to be a way to deregister the name.

      [WARN] BasicDataSource - Failed to complete JMX registration <javax.management.InstanceAlreadyExistsException: org.apache.commons.dbcp2:name=test>javax.management.InstanceAlreadyExistsException: org.apache.commons.dbcp2:name=test
              at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)
              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)
              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)
              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
              at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
              at org.apache.commons.dbcp2.BasicDataSource.jmxRegister(BasicDataSource.java:2224)
              at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:1909)
              at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1433)
              at org.apache.commons.dbcp2.TestBasicDataSource.getConnection(TestBasicDataSource.java:48)
              at org.apache.commons.dbcp2.TestConnectionPool.testHashing(TestConnectionPool.java:530)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at junit.framework.TestCase.runTest(TestCase.java:176)
              at junit.framework.TestCase.runBare(TestCase.java:141)
              at junit.framework.TestResult$1.protect(TestResult.java:122)
              at junit.framework.TestResult.runProtected(TestResult.java:142)
              at junit.framework.TestResult.run(TestResult.java:125)
              at junit.framework.TestCase.run(TestCase.java:129)
              at junit.framework.TestSuite.runTest(TestSuite.java:255)
              at junit.framework.TestSuite.run(TestSuite.java:250)
              at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
              at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
              at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
              at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
              at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
              at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: