WAS上数据库连接池中获取的数据库连接失效,已经失效(Websphere)

在系统日志中找到下面的错误日志:
2014-10-24 10:25:00.508 [mqTaskExecutor-19] ERROR o.s.t.i.TransactionInterceptor -Application exception overridden by rollback exception
org.springframework.dao.DataAccessResourceFailureException: PreparedStatementCallback; SQL [INSERT INTO RE_CORDEROPERATE 			( 				OPERATESTATUS, 				operatetime, 				operatedesc, 				b2citemno, 				SUPPLIERCODE, 				EXCEPTIONDESC, 				OPERATEEMPLOYEE, 				CREATETIME	   			) 			VALUES 			( 			     				?, 				 				 				?, 				 				 				?, 				 				 				?, 				 				 				?, 				 				 				'', 				 				 				?, 				 				CURRENT_TIMESTAMP 			)]; The last packet successfully received from the server was 46,677,980 milliseconds ago.  The last packet sent successfully to the server was 46,677,981 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.; nested exception is com.ibm.websphere.ce.cm.StaleConnectionException: The last packet successfully received from the server was 46,677,980 milliseconds ago.  The last packet sent successfully to the server was 46,677,981 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
	at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:104) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:603) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:812) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:834) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.update(NamedParameterJdbcTemplate.java:260) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.update(NamedParameterJdbcTemplate.java:264) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at com.suning.framework.dal.client.support.executor.MappedSqlExecutor.execute4PrimaryKey(MappedSqlExecutor.java:689) ~[snf-dal-3.0.4.jar:na]
	at com.suning.framework.dal.client.support.executor.MappedSqlExecutor.execute(MappedSqlExecutor.java:649) ~[snf-dal-3.0.4.jar:na]
	at com.suning.framework.dal.client.support.ShardingDalClient.execute(ShardingDalClient.java:286) ~[snf-dal-sharding-1.0.6.jar:na]
	at com.suning.moms.service.impl.ob.UnpaidOrderStatusImportServiceImpl.updateOrderItemStatus(UnpaidOrderStatusImportServiceImpl.java:108) ~[moms-admin-service-1.0.0.jar:na]
	at com.suning.moms.service.impl.ob.UnpaidOrderStatusImportServiceImpl.saveCUnpaidOrderStatus(UnpaidOrderStatusImportServiceImpl.java:91) ~[moms-admin-service-1.0.0.jar:na]
	at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source) ~[na:na]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) ~[na:1.6.0]
	at java.lang.reflect.Method.invoke(Method.java:611) ~[na:1.6.0]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) [spring-tx-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at $Proxy45.saveCUnpaidOrderStatus(Unknown Source) [na:na]
	at com.suning.moms.service.impl.mq.MQMessageServiceImpl.chooseBusinessService(MQMessageServiceImpl.java:168) [moms-admin-service-1.0.0.jar:na]
	at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source) ~[na:na]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) ~[na:1.6.0]
	at java.lang.reflect.Method.invoke(Method.java:611) ~[na:1.6.0]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) [spring-tx-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at $Proxy50.chooseBusinessService(Unknown Source) [na:na]
	at com.suning.moms.service.impl.mq.MQImportThread.runEsbMessage(MQImportThread.java:133) [moms-admin-service-1.0.0.jar:na]
	at com.suning.moms.service.impl.mq.MQImportThread.run(MQImportThread.java:64) [moms-admin-service-1.0.0.jar:na]
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897) [na:1.6.0]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919) [na:1.6.0]
	at java.lang.Thread.run(Thread.java:736) [na:1.6.0]
Caused by: com.ibm.websphere.ce.cm.StaleConnectionException: The last packet successfully received from the server was 46,677,980 milliseconds ago.  The last packet sent successfully to the server was 46,677,981 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.6.0]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56) ~[na:1.6.0]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39) ~[na:1.6.0]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:527) ~[na:1.6.0]
	at com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapExceptionHelper(GenericDataStoreHelper.java:615) ~[rsahelpers.jar:WAS70.SERV1 [cf211150.04]]
	at com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapException(GenericDataStoreHelper.java:677) ~[rsahelpers.jar:WAS70.SERV1 [cf211150.04]]
	at com.ibm.ws.rsadapter.AdapterUtil.mapException(AdapterUtil.java:2112) ~[com.ibm.ws.runtime.jar:na]
	at com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.mapException(WSJdbcUtil.java:1034) ~[com.ibm.ws.runtime.jar:na]
	at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.setAutoCommit(WSJdbcConnection.java:3489) ~[com.ibm.ws.runtime.jar:na]
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.getTargetConnection(LazyConnectionDataSourceProxy.java:417) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:376) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at $Proxy68.prepareStatement(Unknown Source) ~[na:na]
	at org.springframework.jdbc.core.PreparedStatementCreatorFactory$PreparedStatementCreatorImpl.createPreparedStatement(PreparedStatementCreatorFactory.java:245) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:581) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	... 39 common frames omitted


经过定位怀疑是数据库连接池中获取到的连接已经超时,长时间没有被使用导致超时。但是WAS上JDBC-数据源-定制属性-URL属性的值=jdbc:mysql://10.27.88.137:3306/moms_137?useUnicode=true&characterEncoding=utf8&autoReconnect=true这个的配置是对的,配置了自动重新连接。
但是 WAS上JDBC-数据源-WebSphere Application Server 数据源属性-通过 SQL 查询进行验证(不推荐在 V7 中使用)查询熟悉的值=SELECT 1 FROM DUMMYTABLE
,这个查询语句是错的,MYSQL应该写成SELECT 1 ,这样就避免了这个问题。 



你可能感兴趣的:(websphere)