I don't think autoReconnect would help. It'd still throw the exception and then re-connect to the database so the code can retry. Unfortunately it doesn't just silently reconnect and perform the query.

You have configured both testOnBorrow and a validation query, so the connection is verified working before the attempt to retrieve a password. You might want to check firewalls or network hardware between your tomcat server and database server. This smells like a network issue.

--David

Gregor Schneider wrote:
Hi guys,

we're running Tomcta 5.5 and MySQL 5 (InnoDB), OS is Debian. Tomcat
authentication is done via a JDBC-Realm.

Every now and then FormAuthenticator is throwing the following Exception:

2007-06-04 01:41:02,762 ERROR           localSearch.log
[TP-Processor2]:        Exception
performing authentication
com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException:
Communications link failur
e during commit(). Transaction resolution unknown.
       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888)
       at com.mysql.jdbc.Connection.commit(Connection.java:2259)
at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:568) at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:399) at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:347) at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthentica
tor.java:257)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.ja
va:416)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:392) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:10
7)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:88
9)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:6
84)
       at java.lang.Thread.run(Thread.java:595)

Since Google is my friend, I found this link telling me that MySQL's
ConnectorJ times out after 8 hours - *ouch*:
http://dev.mysql.com/doc/refman/5.0/en/connector-j-usagenotes-troubleshooting.html#qandaitem-24-4-5-3-4

Developers there are told to use a connection-pool that can handle
this problem. They discourage anybody to use the
"autoconnect"-feature, since this might be unsafe and become
depricated soon.

Well, well, I'm using the following connection-pool within Tomcat:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
 <Resource
   auth="Container"
   description="DB Connection for SSO"
   name="jdbc/SSODS"
   type="javax.sql.DataSource"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory"
   driverClassName="com.mysql.jdbc.Driver"
   username="XXX"
   password="XXX"
   url="jdbc:mysql://db/apacheSSO"
   maxIdle="5"
   maxWait="10000"
   maxActive="10"
   validationQuery="SELECT 1"
   testOnBorrow="true"
   testWhileIdle="true"
   timeBetweenEvictionRunsMillis="10000"
   minEvictableIdleTimeMillis="28800"
   poolPreparedStatements="true"
   removeAbandoned="true"
   removeAbandonedTimeout="300"
   logAbandoned="false"/>
</Context>

Seems that this connection-pool does not handle this problem properly.

So:

Does any of you gyus have the same problem and has a working solution
fori t? I hate it to check the Tomcat's ERROR-log in the morning and
every day I see a file having a size > 0...

I'm wondering if I simply should add the autoconnect-feature (which is
such a bad, bad thing....) to my connection-pool...

Any oppinions on this appreciated

Gregor


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to