On Wed, Feb 8, 2012 at 1:08 PM, Konstantin Kolinko <knst.koli...@gmail.com> wrote: > 2012/2/8 Jonathan Rosenberg <j...@tabbysplace.org>: >> Vital statistics: >> >> Apache Tomcat/7.0.22 1.6.0_22-b04 Sun Microsystems Inc. Linux >> >> 1) Using org.apache.catalina.realm.UserDatabaseRealm for >> authentication to Manager app. No pooling. >> 2) Running a Grails app that is using CAS authentication on remote >> server. Using dbcp pooling. >> 3) App & Tomcat auth use different DBs App's DB is remote, Tomcat is >> using local DB server. >> 4) App is in testing & lightly used during the day. Works fine. >> 5) App sits idle over night. >> >> If I access my app first thing in the morning, I get the following >> >> Feb 8, 2012 9:09:58 AM org.apache.catalina.realm.JDBCRealm getPassword > > JDBCRealm does not use pooling. (The recommended alternative that uses > pooling is DataSourceRealm). > > It does not match your configuration description above, so I am > confused. Maybe you can inspect your configuration more closely and > find where this realm comes from.
Good point. I have the following Realms in server.xml: <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99" driverName="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost/Tomcat?user=baba&password=booey" userTable="users" userNameCol="username" userCredCol="password" userRoleTable="user_roles" roleNameCol="rolename"/> >> SEVERE: Exception performing authentication >> 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) >> . . . . > > The full stacktrace may help to find where this call comes from. (Re: > your question "Why is Tomcat trying to authenticate?"). > > "newInstance0()", so it tries to create an instance of some class? Here it is. Feb 8, 2012 9:09:58 AM org.apache.catalina.realm.JDBCRealm getPassword SEVERE: Exception performing authentication 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) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.Util.getInstance(Util.java:384) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929) at com.mysql.jdbc.ConnectionImpl.throwConnectionClosedException(ConnectionImpl.java:1193) at com.mysql.jdbc.ConnectionImpl.getMutex(ConnectionImpl.java:3035) at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1612) at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:579) at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:408) at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:355) at org.apache.catalina.realm.CombinedRealm.authenticate(CombinedRealm.java:146) at org.apache.catalina.realm.LockOutRealm.authenticate(LockOutRealm.java:180) at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:157) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:544) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 58,153,867 milliseconds ago. The last packet sent successfully to the server was 58,153,867 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) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3321) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1940) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2275) at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:557) ... 17 more Caused by: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3302) ... 23 more >> >> To me this looks like a DB timeout issue to be solved by pooling. But >> here's where I'm confused: >> >> 1) I'm trying to authenticate via CAS. Tomcat authentication should >> not be an issue. Why is Tomcat trying to authenticate? >> 2) After this exception, my app gets repeated connection failures >> complaining about closed DB connections. But I am using dbcp pooling, >> which I;ve done many times without problems. I feel as is this is >> related to the Tomcat auth failure. >> 3) I have to reload the app to make things start working. >> >> I've spent a few days on this, but just made the (theorized) >> connection between Tomcat auth failure & my app's failures. >> >> I'm gonna start digging into this theory but was hoping for some ideas >> & pointers. >> > > Best regards, > Konstantin Kolinko > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org