Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在Websphere中访问正在关闭的后台线程的JDBC连接_Java_Hibernate_Jdbc_Websphere - Fatal编程技术网

Java 在Websphere中访问正在关闭的后台线程的JDBC连接

Java 在Websphere中访问正在关闭的后台线程的JDBC连接,java,hibernate,jdbc,websphere,Java,Hibernate,Jdbc,Websphere,我在WebSphereApplicationServer6.0(WAS)中的WebSpherePortal Server中运行了一个应用程序。在这个应用程序中,对于一个需要很长时间才能完成的特定功能,我将启动一个执行此操作的新线程。这个新线程从Hibernate打开一个新会话,并开始使用它执行DB事务。有时(无法看到模式),线程内的事务工作正常,进程成功完成。但其他时候,我会发现以下错误: org.hibernate.exception.GenericJDBCException: could n

我在WebSphereApplicationServer6.0(WAS)中的WebSpherePortal Server中运行了一个应用程序。在这个应用程序中,对于一个需要很长时间才能完成的特定功能,我将启动一个执行此操作的新线程。这个新线程从Hibernate打开一个新会话,并开始使用它执行DB事务。有时(无法看到模式),线程内的事务工作正常,进程成功完成。但其他时候,我会发现以下错误:

org.hibernate.exception.GenericJDBCException: could not load an entity: [OBJECT NAME#218294]
...
Caused by: com.ibm.websphere.ce.cm.ObjectClosedException: DSRA9110E: Connection is closed.
Method cleanup failed while trying to execute method cleanup on ManagedConnection WSRdbManagedConnectionImpl@642aa0d8 from resource jdbc/MyJDBCDataSource. Caught exception: com.ibm.ws.exception.WsException: DSRA0080E: An exception was received by the Data Store Adapter. See original exception message: Cannot call 'cleanup' on a ManagedConnection while it is still in a transaction..
我怎样才能阻止这种事情发生?为什么似乎WAS想杀死我的连接,即使它们还没有完成。有没有办法阻止WAS尝试关闭此特定连接


谢谢

我在报告中提到了两个可能的原因:1。
hibernate.connection.release_mode
可选参数或2。一个问题。现在我读了这个问题,我真的开始认为您的问题可能与您正在生成自己的线程这一事实有关。由于它们不由容器管理,这些踏板中使用的连接可能会显示为“泄漏”(未正确关闭),如果WAS试图在某个时候恢复它们,我也不会感到惊讶


如果您想开始一个长时间运行的作业,您应该使用WorkManager。不要自己产生线程。

我会调查WorkManager,你知道这方面的例子吗?@ferrari你可以从这里开始