论坛首页 Java企业应用论坛

链接已经被关闭的问题,我都快疯了。

浏览 3068 次
该帖已经被评为隐藏帖
作者 正文
   发表时间:2007-03-05  
公司一个项目使用Webwork+Spring+iBATIS 这个结构来实现的。应用服务器是resin3.0.19 而是数据库是MYSQL5.0。项目在开发过程中一直很正常没有什么大问题,但进入集成测试后发现经常抛出异常。
500 Servlet Exception
java.lang.IllegalStateException: connection is closed
	at com.caucho.sql.UserConnection.getMConn(UserConnection.java:812)
	at com.caucho.sql.UserConnection.getConnection(UserConnection.java:87)
	at com.caucho.sql.UserConnection.prepareStatement(UserConnection.java:195)
	at sun.reflect.GeneratedMethodAccessor109.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:168)
	at $Proxy27.prepareStatement(Unknown Source)
	at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:172)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:614)
	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:126)
	at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:104)
	at com.ibatis.sqlmap.engine.mapping.statement.PaginatedDataList.getList(PaginatedDataList.java:127)
	at com.ibatis.sqlmap.engine.mapping.statement.PaginatedDataList.pageTo(PaginatedDataList.java:87)
	at com.ibatis.sqlmap.engine.mapping.statement.PaginatedDataList.<init>(PaginatedDataList.java:46)
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForPaginatedList(SqlMapExecutorDelegate.java:671)
	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForPaginatedList(SqlMapSessionImpl.java:134)
	at org.springframework.orm.ibatis.SqlMapClientTemplate$6.doInSqlMapClient(SqlMapClientTemplate.java:273)
	at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:168)
	at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForPaginatedList(SqlMapClientTemplate.java:271)
	at net.pingsoft.pledu.basedao.BaseSqlMapDAO.search(BaseSqlMapDAO.java:92)
	at net.pingsoft.pledu.dao.ibatis.SysSchoolInfoSqlMapDAO.search(SysSchoolInfoSqlMapDAO.java:28)
	at net.pingsoft.pledu.domain.logic.impl.SchoolServiceImpl.searchSchoolByFilter(SchoolServiceImpl.java:207)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:165)
	at $Proxy1.searchSchoolByFilter(Unknown Source)
	at net.pingsoft.pledu.webwork.action.manage.school.ListSchoolInfoAction.searchByName(ListSchoolInfoAction.java:65)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at com.opensymphony.xwork.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:365)
	at com.opensymphony.xwork.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:217)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:191)
	at net.pingsoft.pledu.webwork.Interceptor.UserRightInterceptor.intercept(UserRightInterceptor.java:53)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:189)
	at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:189)
	at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:189)
	at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:189)
	at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:189)
	at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:189)
	at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:189)
	at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:189)
	at com.opensymphony.xwork.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:100)
	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:189)
	at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:113)
	at com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(DispatcherUtils.java:233)
	at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:198)
	at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
	at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:56)
	at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
	at com.opensymphony.webwork.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:78)
	at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
	at net.pingsoft.pledu.servlet.GZIPFilter.doFilter(GZIPFilter.java:63)
	at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
	at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:178)
	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
	at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:268)
	at com.caucho.server.port.TcpConnection.run(TcpConnection.java:389)
	at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:507)
	at com.caucho.util.ThreadPool.run(ThreadPool.java:433)
	at java.lang.Thread.run(Thread.java:595)


--------------------------------------------------------------------------------
Resin-3.0.19 (built Mon, 15 May 2006 04:50:47 PDT) 


本来想将源代码贴出来,但是公司封闭源代码,要申请才行(恶心)。关于这个问题我查过很多,有些说是数据库连接池里的连接失效了,有些说没有关闭连接。因为我们使用的是iBATIS模板方法,它应该自己在用完连接就关闭的,而不需要自己关闭。所以我把注意力放在了连接池。但是不管我怎么找资料还是配置总是不行。

第一次在javaeye上发帖。希望,多谢大家了。
   发表时间:2007-03-05  
没有代码很难猜测,换jetty或者tomcat试试看连接是否关闭。建议把resin更新到最新版本,3.1.1更新了resin的相关错误。

如果还无法解决,请贴代码。
0 请登录后投票
   发表时间:2007-03-05  
是不是  mysql connection url后面要加上  autoConnect=true
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics