GenericJDBCException:无法打开连接..由javax.resource.ResourceException引起:IJ000459:事务处于非活动状态

时间:2015-11-05 22:45:59

标签: java hibernate

我的Hibernate应用程序开始正常运行,但在某些时候发生了某些事情(我怀疑某些意外/未处理的约束违规)以某种方式破坏了一切。从那时起,我继续得到这个巨大的堆栈跟踪,我无法阅读....如果我重新启动应用程序,或注销并登录,问题会消失一段时间......

我找到a related question,但在评论中被要求为我的问题创建一个新问题,因为例外情况非常普遍。

下面是一个剪切版本的堆栈跟踪。在pastebin上完全堆栈跟踪。

2015-11-05 17:27:39,349 ERROR [io.undertow.request] (default task-11) UT005023: Exception handling request to /api/ratings/synch: org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Could not open connection
        at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76) [resteasy-jaxrs-3.0.10.Final.jar:]
        ...
Caused by: javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Could not open connection
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:163) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
        ...
        at net.bridalapp.db.CrudService$$$view1.find(Unknown Source) [classes:]
        ...
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
        at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
        ...
        at net.bridalapp.db.CrudServiceBean.find(CrudServiceBean.java:213) [classes:]
        at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) [:1.8.0_65]
        ...
Caused by: org.hibernate.exception.GenericJDBCException: Could not open connection
        at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
        ...
Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction
        at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:154)
        ...
Caused by: javax.resource.ResourceException: IJ000460: Error checking for a transaction
        at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:415)
        ...
Caused by: javax.resource.ResourceException: IJ000459: Transaction is not active: tx=TransactionImple < ac, BasicAction: 0:ffffac1001d4:-67c5b6ff:563b6a43:146d8 status: ActionStatus.ABORT_ONLY >
        at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:399)
        ... 348 more

http://pastebin.com/DV7zteED

1 个答案:

答案 0 :(得分:0)

我在wildfly / hibernate中遇到了同样的错误。对我来说问题是我运行了一个很长的事务,我有大量的休眠事务,这填补了我的记忆。在我的情况下,答案是,在指定数量的交易后,我这样做: em.flush(); em.clear(); HTH