0

我们运行的应用程序基于Struts 2.0。我们许多人同时访问这个应用程序。大约在同一时间的每个晚上,应用程序都会受到拖延。如果我们在浏览器上重新加载应用程序,它永远不会在登录页面之前移动。 看到服务器的日志,我可以看到最后一条消息是“线程休眠”。IBM Websphere中的ConnectionWaitTimeoutException

在做一些研究时,我遇到了使用Spring框架的注解。 Struts2也有相同的工作吗? 如果可能,请在struts文件中说明使用情况吗?

[4/25/12 15:20:19:595 GMT+05:30] 00000029 SystemOut  O 25 Apr 2012 15:20:19,595 DEBUG [Thread-64][GreeceSynchronizer] thread sleep 
action [[email protected]] 
[4/25/12 15:20:26:293 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,293 DEBUG [WebContainer : 5][I18nInterceptor] intercept '//doLogin' { 
[4/25/12 15:20:26:293 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,293 DEBUG [WebContainer : 5][I18nInterceptor] requested_locale=null 
[4/25/12 15:20:26:293 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,293 DEBUG [WebContainer : 5][I18nInterceptor] before Locale=en_US 
[4/25/12 15:20:26:293 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,293 DEBUG [WebContainer : 5][InstantiatingNullHandler] Entering nullPropertyValue [target=[[email protected], [email protected]], property=struts] 
[4/25/12 15:20:26:294 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,294 DEBUG [WebContainer : 5][FileUploadInterceptor] Bypassing // doLogin 
[4/25/12 15:20:26:294 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,294 DEBUG [WebContainer : 5][StaticParametersInterceptor] Setting static parameters {} 
[4/25/12 15:20:26:294 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,294 DEBUG [WebContainer : 5][ParametersInterceptor] Setting params password => [ DEMO9 ] changePassword => [ false ] forgotPassword => [ ] username => [ DEMO9 ] 
[4/25/12 15:20:26:294 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,294 DEBUG [WebContainer : 5][XWorkConverter] Property: changePassword 
[4/25/12 15:20:26:294 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,294 DEBUG [WebContainer : 5][XWorkConverter] Class: cape.base.lbxoutclearing.ui.action.LoginAction 
[4/25/12 15:20:26:294 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,294 DEBUG [WebContainer : 5][XWorkConverter] field-level type converter for property [changePassword] = none found 
[4/25/12 15:20:26:294 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,294 DEBUG [WebContainer : 5][XWorkConverter] global-level type converter for property [changePassword] = none found 
[4/25/12 15:20:26:294 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,294 DEBUG [WebContainer : 5][XWorkConverter] falling back to default type converter [[email protected]] 
[4/25/12 15:20:26:294 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,294 DEBUG [WebContainer : 5][CompoundRootAccessor] No object in the CompoundRoot has a publicly accessible property named 'forgotPassword' (no setter could be found). 
[4/25/12 15:20:26:294 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,294 DEBUG [WebContainer : 5][CompoundRootAccessor] No object in the CompoundRoot has a publicly accessible property named 'password' (no setter could be found). 
[4/25/12 15:20:26:294 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,294 DEBUG [WebContainer : 5][CompoundRootAccessor] No object in the CompoundRoot has a publicly accessible property named 'username' (no setter could be found). 
[4/25/12 15:20:26:294 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,294 DEBUG [WebContainer : 5][LoginAction] Validating login 
[4/25/12 15:20:26:295 GMT+05:30] 00000030 SystemOut  O 25 Apr 2012 15:20:26,295 DEBUG [WebContainer : 5][LoginAction] 1 
[4/25/12 15:20:31:256 GMT+05:30] 00000036 FreePool  E J2CA0045E: Connection not available while invoking method createOrWaitForConnection for resource lockBoxDSJNDI. 
[4/25/12 15:20:31:292 GMT+05:30] 00000036 SystemOut  O 25 Apr 2012 15:20:31,289 ERROR [WebContainer : 8][BaseDAO] Exception in getConnection() 
com.ibm.websphere.ce.cm.ConnectionWaitTimeoutException: Connection not available, Timed out waiting for 180007 
    at com.ibm.ws.rsadapter.AdapterUtil.toSQLException(AdapterUtil.java:1252) 
    at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:444) 
    at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:400) 
    at cape.base.lbxoutclearing.ui.dao.BaseDAO.getConnection(BaseDAO.java:49) 
Caused by: com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException: Connection not available, Timed out waiting for 180007 
    at com.ibm.ejs.j2c.FreePool.createOrWaitForConnection(FreePool.java:1496) 
    at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:2273) 
    at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:903) 
    at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:603) 
    at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:431) 
    ... 130 more 

回答

2

这与Struts/Spring无关。

容器WAS说​​它无法从连接池中获得连接。

在数据源上指定Connectiontimeout期间。如果在等待那段时间后,如果WAS运行时无法为您的应用程序提供来自池的连接,则会引发此异常。

你必须找出谁在抓住池中的连接并确保连接被释放。

使用此跟踪字符串ConnLeakLogic = finest打开跟踪。发生此异常时,它会转储列出当时正在使用连接的所有线程的状态。这应该是你的起点。

HTH

Manglu