小编Cha*_*ndu的帖子

如何在JBoss AS 7.x -JPA中网络故障后重新建立连接

我的应用程序使用JPA(Hbernate ORM)连接到SQL Server 2008,它部署在JBoss AS 7.x服务器中.如果网络出现故障并再次出现,我将收到以下异常

14:59:27,996 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: The connection is closed.
14:59:28,002 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)   at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361)
14:59:28,012 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)   at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289)
14:59:28,020 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)   at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:261)
14:59:28,025 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)   at com.honeywell.domoweb.dataservice.dao.impl.UserDaoImpl.getUsers(UserDaoImpl.java:372)
14:59:28,030 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:59:28,034 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:59:28,039 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:59:28,044 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)   at java.lang.reflect.Method.invoke(Method.java:597)
14:59:28,047 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
14:59:28,052 ERROR [stderr] (http-localhost-127.0.0.1-8080-1)   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
14:59:28,058 ERROR [stderr] …
Run Code Online (Sandbox Code Playgroud)

hibernate jpa-2.0 jboss7.x

2
推荐指数
1
解决办法
8017
查看次数

标签 统计

hibernate ×1

jboss7.x ×1

jpa-2.0 ×1