UniversalConnectionPoolManagerMBean在应用程序“重新启动”后已经存在

时间:2013-03-01 20:30:18

标签: java webserver weblogic connection-pooling

当我部署一个在我的weblogic服务器上有一个servlet的application.war时,它运行正常。它使用实例UniversalConnectionPoolManagerMBean并启动正常。

在管理控制台中,我使用工作完成时停止命令,并在其调用的destroy()方法中使用:

UniversalConnectionPoolManagerImpl.getUniversalConnectionPoolManager()
                .startConnectionPool(mConnectionPoolName);

当我在管理控制台中单击“开始服务请求”命令时,我得到以下异常:

 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

从那时起,即使我停止服务器并重新启动并尝试部署,也会抛出此异常。只有当我清理所有已发布的资源时,这才会消失。我知道在destroy方法中没有正确清理已发布的资源,我认为资源是UniversalConnectionPoolManagerMBean实例,但我认为destroyConnectionPool这样做: http://docs.oracle.com/cd/B28359_01/java.111/e11990/oracle/ucp/admin/UniversalConnectionPoolManagerMBean.html#destroyConnectionPool_java_lang_String_

有没有人知道在尝试清理UniversalConnectionPoolManagerMBean实例时我做错了什么?或者,如果这不是正确的解决方案,那么

就像一个有趣的(但不安全,我不会实现)解决方法:出于某种原因,当我将其插入初始化时:

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

     } 

抛出异常并发现它无法找到具有此名称的connectionPool来销毁,但我原来的问题已经消失。它不会抛出javax.management.InstanceAlreadyExistsException: oracle.ucp.admin:name=UniversalConnectionPoolManagerMBean

2 个答案:

答案 0 :(得分:1)

此错误似乎已在版本11.2.0.4和12.1.0.2中得到修复。我无法找到任何关于它的文档,但对我来说,上述版本的错误消失了。

JDBC / UCP下载页面: http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html

答案 1 :(得分:0)

这是来自Oracle的11.2.0.4 UCP.jar README.txt。

11.2.0.4中的修复

16805157创建UniversalConnectionPoolManagerMBean的名称           每个类加载器唯一,因此对每个UCP实例都是唯一的           甚至在同一个JVM中

这修复了原始问题中描述的javax.management.InstanceAlreadyExistsException。创建的每个连接池都具有唯一的名称,不会导致InstanceAlreadyExistsException。但是,由于您正在重新启动,因此您应该考虑如何干净地关闭连接池MBean,这样您就不会遇到这个问题。