Messages per Month
|Subject:||Re: jdbc realm fails to authenticate sometimes|
|From:||John M. Hollingsworth (jmh_...@cox.net)|
|Date:||Oct 4, 2002 10:22:45 am|
I have found the version of the MySQL connector to be the problem. Versions
earlier than 2.0.9 gave me the same problem you're experiencing. The latest
version is 2.0.14, I think.
I am running Tomcat 4.1.10 and using a jdbc realm with mysql. It is setup accordingto the docs on the jakarta web site. (At least I think it is!)
The entry in my server.xml file looks like this:
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99" driverName="org.gjt.mm.mysql.Driver" connectionURL="jdbc:mysql://localhost/authority" connectionName="me" connectionPassword="mypassword" userTable="users" userNameCol="user_name" userCredCol="user_pass" userRoleTable="user_roles" roleNameCol="role_name"/>
I am finding occasional authentication failures that always follow the
same pattern.I say occasional in that often the authentication works perfectly
When it doesn't this is what happens...
1) user tries to authenticate (typing very carefully the username and
password),tomcat throws error, sending user to error.jsp page.
2) Sometimes, on second attempt, authentication works, and user is allowed
3) However, sometimes on second attempt, Tomcat throws a null pointer
exception.If the user simply presses retry (on the browser) at that point,
he/she is allowedaccess to the application! So, in this case, somehow the authentication is takingplace on the second attempt, but an exception is being thrown
I was wondering if this had something to do with the 8 hour disconnect of mysql, andI added: autoreconnect=true to the URL above, but that didn't seem to fix the problem.
This is driving users of my webapp nuts (as you can imagine). Does anyone haveany ideas of where to look, or what I can do to avoid this?
Thanks Paul Phillips