Oracle UCP and NullPointerException



我正在尝试将Oracle通用连接池(UCP)与tomcat6集成。服务器配置如下:

server.xml

<Resource name="jdbc/MyDB"
  auth="Container"
  factory="oracle.ucp.jdbc.PoolDataSourceImpl"
  type="oracle.ucp.jdbc.PoolDataSource"
  description="Oracle Universal Connection Pool"
  connectionFactoryClassName="oracle.jdbc.pool.OracleDataSource"
  minPoolSize="1"
  maxPoolSize="5"
  inactiveConnectionTimeout="20"
  connectionPoolName="UCPPool"
  validateConnectionOnBorrow="true"
  sqlForValidateConnection="select 1 from DUAL"
  fastConnectionFailoverEnabled="true"
  onsConfiguration="nodes=test11grac1.example.com:6200,test11grac2.example.com:6200"
  user="test"
  password="XXXX"
  url="jdbc:oracle:thin:@test11g-cluster.example.com:1521/testdb"/>

context.xml

 <ResourceLink name="jdbc/MyDB" global="jdbc/MyDB" />

最初这个配置工作得很好。连接均匀地分布在两个RAC实例上,当一个实例宕机时,所有后续请求都指向正在工作的那个。

经过一个晚上的空闲时间后,所有对连接池的请求都导致以下异常:

Caused by: java.lang.NullPointerException: null
    at oracle.ucp.jdbc.oracle.OracleJDBCConnectionPool.createOnePooledConnection(OracleJDBCConnectionPool.java:1260) ~[ucp.jar:11.2.0.3.0]
    at oracle.ucp.common.UniversalConnectionPoolImpl.borrowConnectionWithoutCountingRequests(UniversalConnectionPoolImpl.java:339) ~[ucp.jar:11.2.0.3.0]
    at oracle.ucp.common.UniversalConnectionPoolImpl.borrowConnectionAndValidate(UniversalConnectionPoolImpl.java:168) ~[ucp.jar:11.2.0.3.0]
    at oracle.ucp.common.UniversalConnectionPoolImpl.borrowConnection(UniversalConnectionPoolImpl.java:143) ~[ucp.jar:11.2.0.3.0]
    at oracle.ucp.jdbc.JDBCConnectionPool.borrowConnection(JDBCConnectionPool.java:157) ~[ucp.jar:11.2.0.3.0]
    at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:931) ~[ucp.jar:11.2.0.3.0]
    at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:873) ~[ucp.jar:11.2.0.3.0]
    at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:863) ~[ucp.jar:11.2.0.3.0]
    at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:46) ~[hibernate-entitymanager-3.4.0.GA.jar:3.4.0.GA]

是什么可能导致这个异常,是否有解决方法?

ojdbc6.jarucp.jar升级到最新(12c)版本后。

相关内容

  • 没有找到相关文章

最新更新