Application is not Accessible due to stale connection in Connection pool
karna1824 Aug 28, 2013 3:05 AMhi, I am using Jboss AS 7.1.1 Final. My application was deployed and running on AWS. Daily morning when i tried to access my application using URL, it was not accessible. I have been facing this problem from so many days. Daily i need to be restart the server to access my application because of the stale connection in connection pool. I have made the min pool size to 0 and tried,it worked but that was not the correct solution, that is just a workaround. when i checked the log file, i got below statements.
09:59:21,403 ERROR [org.apache.shiro.realm.jdbc.JdbcRealm] (http--0.0.0.0-80-1) There was a SQL error while authenticating user : com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed by the driver.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_19]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_19]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_19]
at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_19]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:407) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.Util.getInstance(Util.java:382) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1013) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.ConnectionImpl.throwConnectionClosedException(ConnectionImpl.java:1213) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.ConnectionImpl.checkClosed(ConnectionImpl.java:1200) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.ConnectionImpl.prepareStatement(ConnectionImpl.java:4203) [mysql-connector-java-5.1.15-bin.jar:]
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.doPrepareStatement(BaseWrapperManagedConnection.java:677)
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.prepareStatement(BaseWrapperManagedConnection.java:663)
at org.jboss.jca.adapters.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:404)
at org.apache.shiro.realm.jdbc.JdbcRealm.getPasswordForUser(JdbcRealm.java:280) [shiro-core-1.2.1.jar:1.2.1]
at org.apache.shiro.realm.jdbc.JdbcRealm.doGetAuthenticationInfo(JdbcRealm.java:221) [shiro-core-1.2.1.jar:1.2.1]
at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568) [shiro-core-1.2.1.jar:1.2.1]
at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180) [shiro-core-1.2.1.jar:1.2.1]
at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267) [shiro-core-1.2.1.jar:1.2.1]
at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198) [shiro-core-1.2.1.jar:1.2.1]
at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106) [shiro-core-1.2.1.jar:1.2.1]
at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:270) [shiro-core-1.2.1.jar:1.2.1]
at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256) [shiro-core-1.2.1.jar:1.2.1]
at org.apache.shiro.web.filter.authc.AuthenticatingFilter.executeLogin(AuthenticatingFilter.java:53) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.shiro.web.filter.authc.FormAuthenticationFilter.onAccessDenied(FormAuthenticationFilter.java:154) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.shiro.web.filter.AccessControlFilter.onAccessDenied(AccessControlFilter.java:133) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.shiro.web.filter.AccessControlFilter.onPreHandle(AccessControlFilter.java:162) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.shiro.web.filter.PathMatchingFilter.isFilterChainContinued(PathMatchingFilter.java:203) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.shiro.web.filter.PathMatchingFilter.preHandle(PathMatchingFilter.java:178) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:131) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-core-1.2.1.jar:1.2.1]
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-core-1.2.1.jar:1.2.1]
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [shiro-core-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.2.1.jar:1.2.1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_19]
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 83,401,204 milliseconds ago. The last packet sent successfully to the server was 83,401,205 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) [rt.jar:1.7.0_19]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_19]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_19]
at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_19]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:407) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3358) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1970) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) [mysql-connector-java-5.1.15-bin.jar:]
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2281) [mysql-connector-java-5.1.15-bin.jar:]
at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
at org.apache.shiro.realm.jdbc.JdbcRealm.getPasswordForUser(JdbcRealm.java:284) [shiro-core-1.2.1.jar:1.2.1]
... 38 more
Caused by: java.net.SocketException: Connection timed out
at java.net.SocketOutputStream.socketWrite0(Native Method) [rt.jar:1.7.0_19]
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) [rt.jar:1.7.0_19]
at java.net.SocketOutputStream.write(SocketOutputStream.java:153) [rt.jar:1.7.0_19]
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) [rt.jar:1.7.0_19]
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) [rt.jar:1.7.0_19]
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3339) [mysql-connector-java-5.1.15-bin.jar:]
... 45 more
Can anyone please help me to get rid of this...?
kindly ask me if you need more info to slove this...
Thank you in advance...