You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by pprun <ru...@hotmail.com> on 2009/10/09 16:56:14 UTC
DataSourceRealm failed to retrieve password after tomcat server
being idle overnight
Hi,
I am using DataSourceRealm to authenticate user in my application on Tomcat
5.5.28. When I left server idle overnight and tried to login into the
application the next day, DataSourceRealm would fail in retrieving password.
The following error message was shown in the console:
SEVERE: Exception retrieving password for "test1"
9-Oct-2009 9:22:22 AM org.apache.catalina.realm.DataSourceRealm close
SEVERE: Exception closing database connection
java.sql.SQLException: Already closed.
at
org.apache.tomcat.dbcp.dbcp.PoolableConnection.close(PoolableConnection.java:84)
at
org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181)
at
org.apache.catalina.realm.DataSourceRealm.close(DataSourceRealm.java:379)
at
org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:301)
at
org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:258)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:417)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)
Do anyone know how to resolve this issue? Any help appreciated. Thanks
Below is my context configuration in server.xml:
<Context docBase="Reprosource" path="/Reprosource" reloadable="true"
source="org.eclipse.jst.j2ee.server:Reprosource">
<Resource name="jdbc/rpsDB"
auth="Container"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
maxWait="10000"
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true"
username="user1"
password="web01"
driverClassName="org.gjt.mm.mysql.Driver"
url="jdbc:mysql://localhost:3306/rpsmaster"/>
<Realm className="org.apache.catalina.realm.DataSourceRealm"
dataSourceName="jdbc/rpsDB"
userTable="users"
userNameCol="user_name"
userCredCol="user_pass"
userRoleTable="user_roles"
roleNameCol="role_name"
digest="MD5"
localDataSource="true"/>
</Context>
-- Run
--
View this message in context: http://www.nabble.com/DataSourceRealm-failed-to-retrieve-password-after-tomcat-server-being-idle-overnight-tp25822607p25822607.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DataSourceRealm failed to retrieve password after tomcat server
being idle overnight
Posted by pprun <ru...@hotmail.com>.
Thanks for the help. The error message is misleading. I have tried out the
two parameters and they worked great. I no longer get the error. Thank you.
pprun wrote:
>
> Hi,
>
> I am using DataSourceRealm to authenticate user in my application on
> Tomcat 5.5.28. When I left server idle overnight and tried to login into
> the application the next day, DataSourceRealm would fail in retrieving
> password. The following error message was shown in the console:
>
> SEVERE: Exception retrieving password for "test1"
> 9-Oct-2009 9:22:22 AM org.apache.catalina.realm.DataSourceRealm close
> SEVERE: Exception closing database connection
> java.sql.SQLException: Already closed.
> at
> org.apache.tomcat.dbcp.dbcp.PoolableConnection.close(PoolableConnection.java:84)
> at
> org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181)
> at
> org.apache.catalina.realm.DataSourceRealm.close(DataSourceRealm.java:379)
> at
> org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:301)
> at
> org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:258)
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:417)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
> at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
> at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
> at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
> at java.lang.Thread.run(Thread.java:595)
>
> Do anyone know how to resolve this issue? Any help appreciated. Thanks
>
> Below is my context configuration in server.xml:
>
> <Context docBase="Reprosource" path="/Reprosource" reloadable="true"
> source="org.eclipse.jst.j2ee.server:Reprosource">
> <Resource name="jdbc/rpsDB"
> auth="Container"
> type="javax.sql.DataSource"
> maxActive="100"
> maxIdle="30"
> maxWait="10000"
> removeAbandoned="true"
> removeAbandonedTimeout="60"
> logAbandoned="true"
> username="user1"
> password="web01"
> driverClassName="org.gjt.mm.mysql.Driver"
> url="jdbc:mysql://localhost:3306/rpsmaster"/>
>
> <Realm className="org.apache.catalina.realm.DataSourceRealm"
> dataSourceName="jdbc/rpsDB"
> userTable="users"
> userNameCol="user_name"
> userCredCol="user_pass"
> userRoleTable="user_roles"
> roleNameCol="role_name"
> digest="MD5"
> localDataSource="true"/>
> </Context>
>
> -- Run
>
--
View this message in context: http://www.nabble.com/DataSourceRealm-failed-to-retrieve-password-after-tomcat-server-being-idle-overnight-tp25822607p25834516.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DataSourceRealm failed to retrieve password after tomcat server
being idle overnight
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Chuck,
On 10/9/2009 11:04 AM, Caldarale, Charles R wrote:
>> From: pprun [mailto:runping_huang@hotmail.com]
>> Subject: DataSourceRealm failed to retrieve password after tomcat
>> server being idle overnight
>>
>> When I left server idle overnight and tried to login
>> into the application the next day, DataSourceRealm
>> would fail in retrieving password.
>
> Not uncommon - the DB server timed out the session. Try adding this to your <Resource>:
>
> testOnBorrow="true"
> validationQuery="/* ping */ SELECT 1"
The error message is definitely misleading, though, since it says
"Connection is already closed" when calling conn.close(). That message
makes it seem like the DataSourceRealm has a bug in it that is
attempting to close the connection multiple times (or is holding on to a
reference to a Connection returned to the pool earlier).
I suppose DataSourceRealm could use conn.isClosed() before the call to
close(), but that would probably just clutter the code unnecessarily. It
would, however, remove the misleading error message.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkrPkTYACgkQ9CaO5/Lv0PAVFQCfYkGvY89mtALjTtDvvP3w7UuS
GigAn0UYHM0H3cMYMWuvwJxcmyMp+Pfy
=QKSW
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: DataSourceRealm failed to retrieve password after tomcat server
being idle overnight
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: pprun [mailto:runping_huang@hotmail.com]
> Subject: DataSourceRealm failed to retrieve password after tomcat
> server being idle overnight
>
> When I left server idle overnight and tried to login
> into the application the next day, DataSourceRealm
> would fail in retrieving password.
Not uncommon - the DB server timed out the session. Try adding this to your <Resource>:
testOnBorrow="true"
validationQuery="/* ping */ SELECT 1"
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org