Sebb created DBCP-411:
-------------------------
Summary: TestBasicManagedDataSource - duplicate JMX registrations
Key: DBCP-411
URL: https://issues.apache.org/jira/browse/DBCP-411
Project: Commons Dbcp
Issue Type: Bug
Affects Versions: 2.0
Reporter: Sebb
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.
{noformat}
[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)
{noformat}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)