Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UniversalConnectionPoolManagerMBean Already exists after application "re"start

When I deploy an application.war that contains a servlet to my weblogic server it runs fine. The servlet uses an instance of UniversalConnectionPoolManagerMBean and starts up without any problems.

In the administration console I use the "stop when work completes" command and in my destroy() method it calls:

UniversalConnectionPoolManagerImpl.getUniversalConnectionPoolManager()
                .startConnectionPool(mConnectionPoolName);

When I then click on "start servicing requests" command in the administration console I get this exception:

 java.sql.SQLException: Unable to start the Universal Connection Pool: java.sql.SQLException: Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: MBean exception occurred while registering or unregistering the MBean
at com.exzac.dal.jdbc.Database.getConnection(Database.java:134)
at com.exzac.dal.jdbc.Database.executeQuery(Database.java:161)
at com.exzac.profilesystem.ProfileSystemConfiguration.retrieveConfigurationTable(ProfileSystemConfiguration.java:214)
... 49 more
Caused by: java.sql.SQLException: Unable to start the Universal Connection Pool:     java.sql.SQLException: Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: MBean exception occurred while registering or unregistering the MBean
at oracle.ucp.util.UCPErrorHandler.newSQLException(UCPErrorHandler.java:541)
at oracle.ucp.jdbc.PoolDataSourceImpl.throwSQLException(PoolDataSourceImpl.java:587)
at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java:276)
at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:646)
at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:613)
at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:607)
at com.exzac.dal.jdbc.Database.getConnection(Database.java:132)
... 51 more
 Caused by: java.sql.SQLException: Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: MBean exception occurred while registering or unregistering the MBean
at oracle.ucp.util.UCPErrorHandler.newSQLException(UCPErrorHandler.java:541)
at oracle.ucp.jdbc.PoolDataSourceImpl.throwSQLException(PoolDataSourceImpl.java:587)
at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java:247)
... 55 more
 Caused by: oracle.ucp.UniversalConnectionPoolException: MBean exception occurred while registering or unregistering the MBean
at oracle.ucp.util.UCPErrorHandler.newUniversalConnectionPoolException(UCPErrorHandler.java:421)
at oracle.ucp.util.UCPErrorHandler.newUniversalConnectionPoolException(UCPErrorHandler.java:389)
at oracle.ucp.admin.UniversalConnectionPoolManagerMBeanImpl.getUniversalConnectionPoolManagerMBean(UniversalConnectionPoolManagerMBeanImpl.java:149)
at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java:242)
... 55 more
 Caused by: java.security.PrivilegedActionException: javax.management.InstanceAlreadyExistsException: oracle.ucp.admin:name=UniversalConnectionPoolManagerMBean
at java.security.AccessController.doPrivileged(Native Method)
at oracle.ucp.admin.UniversalConnectionPoolManagerMBeanImpl.getUniversalConnectionPoolManagerMBean(UniversalConnectionPoolManagerMBeanImpl.java:136)
... 56 more
 Caused by: javax.management.InstanceAlreadyExistsException: oracle.ucp.admin:name=UniversalConnectionPoolManagerMBean
at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:453)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1484)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:963)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:917)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$27.run(WLSMBeanServerInterceptorBase.java:714)
at java.security.AccessController.doPrivileged(Native Method)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.registerMBean(WLSMBeanServerInterceptorBase.java:709)
at weblogic.management.mbeanservers.internal.JMXContextInterceptor.registerMBean(JMXContextInterceptor.java:448)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$27.run(WLSMBeanServerInterceptorBase.java:712)
at java.security.AccessController.doPrivileged(Native Method)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.registerMBean(WLSMBeanServerInterceptorBase.java:709)
at weblogic.management.jmx.mbeanserver.WLSMBeanServer.registerMBean(WLSMBeanServer.java:462)
at oracle.ucp.admin.UniversalConnectionPoolManagerMBeanImpl$2.run(UniversalConnectionPoolManagerMBeanImpl.java:142)
... 58 more

From then on I hit this exception, even when I stop the server and restart and try to deploy. Only cleaning all published resources seems to clear the exception. I understand that a published resource was not properly cleaned in the destroy method, and I am thinking that the resource is the UniversalConnectionPoolManagerMBean instance, but I thought it would be clean up by the destroyConnectionPool method: http://docs.oracle.com/cd/B28359_01/java.111/e11990/oracle/ucp/admin/UniversalConnectionPoolManagerMBean.html#destroyConnectionPool_java_lang_String_

How do I avoid hitting this exception?

Just as an interesting (yet unsafe) workaround: For some reason when I insert this into the initialization:

 try {
     UniversalConnectionPoolManagerImpl.getUniversalConnectionPoolManager().destroyConnectionPool(mConnectionPoolName);
     } catch (final Exception e1) {
     LOGGER.error(e1);

     } 

the exception is thrown and caught saying that it could not find a connectionPool with this name to destroy, but the original problem is gone. javax.management.InstanceAlreadyExistsException: oracle.ucp.admin:name=UniversalConnectionPoolManagerMBean is not thrown

like image 380
jon Avatar asked Mar 01 '13 20:03

jon


1 Answers

This bug seems to have been fixed in versions 11.2.0.4 and 12.1.0.2. I couldn't find any documentation about it, but for me the error disappeared with the above mentioned versions.

JDBC/UCP Download Page: http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html

like image 74
jansohn Avatar answered Oct 18 '22 17:10

jansohn