我们最近从Oracle 11g迁移到了Oracle 12c。我们使用的webapp适用于Hibernate。因此,当某个线程上的事务开始时,有时它会运行,有时它会产生以下错误。当我们开始研究11g而不是12c时,这个错误并没有提前。根据Oracle12c,我们需要在代码中进行哪些更改?我们已经为oracle 12c使用了新的ojdbc驱动程序。请帮助我们。
javax.persistence.PersistenceException: org.hibernate.TransactionException: JDBC begin failed:
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1214)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1147)
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1224)
at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:63)
at com.xyz.geo.wherehaus.ui.data.ImportTask.startTransaction(ImportTask.java:243)
at com.xyz.geo.wherehaus.ui.data.ImportTask.call(ImportTask.java:105)
at com.xyz.geo.wherehaus.ui.data.ImportTask.call(ImportTask.java:63)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.hibernate.TransactionException: JDBC begin failed:
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:92)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1473)
at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:60)
... 7 more
Caused by: java.sql.SQLRecoverableException: Closed Connection
at oracle.jdbc.driver.PhysicalConnection.getAutoCommit(PhysicalConnection.java:4337)
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:125)
at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:94)
at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:71)
at org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer.invoke(ResetAbandonedTimer.java:63)
at com.sun.proxy.$Proxy36.getAutoCommit(Unknown Source)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:81)