GenericJDBCException:无法打开连接..由javax.resource.ResourceException导致:IJ000459:事务处于非活动状态 [英] GenericJDBCException: Could not open connection .. caused by javax.resource.ResourceException: IJ000459: Transaction is not active

查看:4332
本文介绍了GenericJDBCException:无法打开连接..由javax.resource.ResourceException导致:IJ000459:事务处于非活动状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



我发现了相关问题,但在评论中被问到为我的问题创建了一个新的例外,因为这个例外是非常通用的。



低于堆栈跟踪的剪切版本。

  2015-11-05 17:27:39,349错误[io.undertow.request](默认任务-11)UT005023:对/ api / ratings / synch的异常处理请求:org.jboss.resteasy.spi.UnhandledException:javax.ejb.EJBTransactionRolledbackException:org.hibernate.exception.GenericJDBCException:无法在org中打开连接
.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)[resteasy-jaxrs-3.0.10.Final.jar:]
...
引起:javax.ejb.EJBTransactionRolledbackException :org.hibernate.exception.GenericJDBCException:无法在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:]
...
引起:javax.persistence.PersistenceException:org.hibernate.exception.GenericJDBCExceptio n:无法在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]
...
导致:org.hibernate.exception.GenericJDBCException:无法打开连接
在org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54 )[hibernate-core-4.3.7.Final.jar:4.3.7.Final]
...
导致:java.sql.SQLException:javax.resource.ResourceException:IJ000460:错误检查对于事务
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:154)
...
引起:javax.resource.ResourceException:IJ000460:错误检查一个事务
在org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:415)
...
导致:javax.resource.ResourceException:IJ000459:事务处于非活动状态: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

解决方案

我在wildfly / hibernate中有同样的错误。对我而言,问题是我正在运行一个长时间的事务,而且我有大量的休眠事务,这些事务填满了我的记忆。在我的情况下,答案是,在指定数量的事务之后,我做了这样的事情:
em.flush();
em.clear();
HTH


My Hibernate application starts running fine, but at some point something happens (I suspect some unexpected/unhandled constraint violation) that somehow breaks everything. From that point on I keep getting this huge stacktrace that I have trouble reading.... If I restart the app, or logout and login, the problem disappears for a while...

I found a related question, but was asked in the comments to create a new one for my issue as the exception is a very generic one.

Below a snipped version of the stacktrace. Full stacktrace on 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

解决方案

I had the same error in wildfly/hibernate. For me the problem was that I was running a long transaction and I had a massive amount of hibernate transactions, that filled up my memory. In my case the answer was, that after a specified number of transactions I did this: em.flush(); em.clear(); HTH

这篇关于GenericJDBCException:无法打开连接..由javax.resource.ResourceException导致:IJ000459:事务处于非活动状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆