Shouldn't your connection URL look something like this:
jdbc:mysql//db:3306/apacheSSO instead of jdbc:mysql://db/apacheSSO?  Not
sure if this means anything, since you say it's already working...  It just
looks strange.

-----Original Message-----
From: Gregor Schneider [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 04, 2007 12:52 AM
To: Tomcat Users List
Subject: Strange MySQL-Behaviour with JDBC-Realm

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(FormAuthent
ica
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.jav
a: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-troubleshootin
g.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
--
what's puzzlin' you, is the nature of my game
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

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



---------------------------------------------------------------------
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