数据源不定时间段后连接中断问题解决办法

jboss异常:sql error 17002和sql error 17008

原为行业内业务系统,布署了两套系统,分别采用jboss和weblogic作为服务器,两套系统在同一个物理机器上,使用两个端口。

服务器:weblogic12.1.2 jboss eap6.0

:oracle12(另一个物理机器,两套系统共用)

jboss系统在试运行过程中,会不定时挂掉,经查询jboss日志,当系统挂掉时,会报sql error 17008和sql error 17002的错误,如下:

[html] view plain copy

09:24:41,771 warn [org.hibernate.engine.jdbc.spi.sqlexceptionhelper] (http-/0.0.0.0:8089-11) sql error: 17008, sqlstate: 99999

09:24:41,771 error [org.hibernate.engine.jdbc.spi.sqlexceptionhelper] (http-/0.0.0.0:8089-11) closed connection

09:24:41,771 error [org.jboss.as.ejb3.tx.cmttxinterceptor] (http-/0.0.0.0:8089-11) javax.ejb.ejbtransactionrolledbackexception: org.hibernate.exception.genericjdbcexception: closed connection

09:24:41,772 error [org.jboss.as.ejb3.invocation] (http-/0.0.0.0:8089-11) jbas014134: ejb invocation failed on component jpadaoimpl for method public abstract java.util.list com.xxxx.getobjects(java.lang.string,boolean): javax.ejb.ejbtransactionrolledbackexception: org.hibernate.exception.genericjdbcexception: closed connection

at org.jboss.as.ejb3.tx.cmttxinterceptor.handleincallertx(cmttxinterceptor.java:138) [jboss-as-ejb3-7.1.2.final-redhat-1.jar:7.1.2.final-redhat-1]

at org.jboss.as.ejb3.tx.cmttxinterceptor.invokeincallertx(cmttxinterceptor.java:203) [jboss-as-ejb3-7.1.2.final-redhat-1.jar:7.1.2.final-redhat-1]

at org.jboss.as.ejb3.tx.cmttxinterceptor.required(cmttxinterceptor.java:305) [jboss-as-ejb3-7.1.2.final-redhat-1.jar:7.1.2.final-redhat-1] ……

[html] view plain copy

caused by: javax.persistence.persistenceexception: org.hibernate.exception.genericjdbcexception: closed connection

at org.hibernate.ejb.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1372) [hibernate-entitymanager-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1]

at org.hibernate.ejb.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1295) [hibernate-entitymanager-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1]

at org.hibernate.ejb.queryimpl.getsingleresult(queryimpl.java:317) [hibernate-entitymanager-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1] ……

[html] view plain copy

caused by: org.hibernate.exception.genericjdbcexception: closed connection

at org.hibernate.exception.internal.standardsqlexceptionconverter.convert(standardsqlexceptionconverter.java:54) [hibernate-core-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1]

at org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:125) [hibernate-core-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1]

at org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:110) [hibernate-core-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1] ……

[html] view plain copy

caused by: java.sql.sqlexception: closed connection

at oracle.jdbc.driver.sqlstatemapping.newsqlexception(sqlstatemapping.java:70)

at oracle.jdbc.driver.databaseerror.newsqlexception(databaseerror.java:133) [ojdbc14.jar:oracle jdbc driver version – “10.2.0.3.0”]

at oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:199) [ojdbc14.jar:oracle jdbc driver version – “10.2.0.3.0”]

at oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:263) [ojdbc14.jar:oracle jdbc driver version – “10.2.0.3.0”] ……[html] view plain copy

09:24:54,605 warn [org.hibernate.engine.jdbc.spi.sqlexceptionhelper] (http-/0.0.0.0:8089-7) sql error: 17002, sqlstate: 08006

09:24:54,605 error [org.hibernate.engine.jdbc.spi.sqlexceptionhelper] (http-/0.0.0.0:8089-7) io exception: connection timed out

09:24:54,606 error [org.jboss.as.ejb3.tx.cmttxinterceptor] (http-/0.0.0.0:8089-7) javax.ejb.ejbtransactionrolledbackexception: org.hibernate.exception.jdbcconnectionexception: io exception: connection timed out

09:24:54,606 error [org.jboss.as.ejb3.invocation] (http-/0.0.0.0:8089-7) jbas014134: ejb invocation failed on component jpadaoimpl for method public abstract java.lang.object com.xxxx.jpa.jpadao.getsingleobject(java.lang.string,java.lang.object[]): javax.ejb.ejbtransactionrolledbackexception: org.hibernate.exception.jdbcconnectionexception: io exception: connection timed out

at org.jboss.as.ejb3.tx.cmttxinterceptor.handleincallertx(cmttxinterceptor.java:138) [jboss-as-ejb3-7.1.2.final-redhat-1.jar:7.1.2.final-redhat-1]

at org.jboss.as.ejb3.tx.cmttxinterceptor.invokeincallertx(cmttxinterceptor.java:203) [jboss-as-ejb3-7.1.2.final-redhat-1.jar:7.1.2.final-redhat-1]

at org.jboss.as.ejb3.tx.cmttxinterceptor.required(cmttxinterceptor.java:305) [jboss-as-ejb3-7.1.2.final-redhat-1.jar:7.1.2.final-redhat-1] ……[html] view plain copy

caused by: javax.persistence.persistenceexception: org.hibernate.exception.jdbcconnectionexception: io exception: connection timed out

at org.hibernate.ejb.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1372) [hibernate-entitymanager-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1]

at org.hibernate.ejb.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1295) [hibernate-entitymanager-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1]

at org.hibernate.ejb.queryimpl.getresultlist(queryimpl.java:265) [hibernate-entitymanager-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1] ……

[html] view plain copy

caused by: org.hibernate.exception.jdbcconnectionexception: io exception: connection timed out

at org.hibernate.exception.internal.sqlstateconversiondelegate.convert(sqlstateconversiondelegate.java:131) [hibernate-core-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1]

at org.hibernate.exception.internal.standardsqlexceptionconverter.convert(standardsqlexceptionconverter.java:49) [hibernate-core-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1]

at org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:125) [hibernate-core-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1]

at org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:110) [hibernate-core-4.1.3.final-redhat-1.jar:4.1.3.final-redhat-1] ……[html] view plain copy

caused by: java.sql.sqlrecoverableexception: io exception: connection timed out

at oracle.jdbc.driver.sqlstatemapping.newsqlexception(sqlstatemapping.java:101)

at oracle.jdbc.driver.databaseerror.newsqlexception(databaseerror.java:133) [ojdbc14.jar:oracle jdbc driver version – “10.2.0.3.0”]

at oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:199) [ojdbc14.jar:oracle jdbc driver version – “10.2.0.3.0”]

at oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:263) [ojdbc14.jar:oracle jdbc driver version – “10.2.0.3.0”]

at oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:521) [ojdbc14.jar:oracle jdbc driver version – “10.2.0.3.0”] ……

[html] view plain copy

caused by: java.net.socketexception: connection timed out

at java.net.socketinputstream.socketread0(native method) [rt.jar:1.6.0_30]

at java.net.socketinputstream.read(socketinputstream.java:129) [rt.jar:1.6.0_30]

at oracle.net.ns.packet.receive(packet.java:240) [ojdbc14.jar:oracle jdbc driver version – “10.2.0.3.0”]

at oracle.net.ns.datapacket.receive(datapacket.java:92) [ojdbc14.jar:oracle jdbc driver version – “10.2.0.3.0”] ……解决办法:[html] view plain copy

jdbc:oracle:thin:@ip地址:1521:orcl

oracle.jdbc.driver.oracledriver

oracle

2

20

true

false

failingconnectiononly

dbusername

dbpassword

oracle.jdbc.xa.client.oraclexadatasource

对数据库连接进行验证。

 

(0)
上一篇 2022年3月21日
下一篇 2022年3月21日

相关推荐