tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ruth, Brice" <br...@fiskars.com>
Subject DBCP/JNDI/Realms
Date Mon, 06 Dec 2004 16:32:26 GMT
Good morning!

I've been running into an intermittent problem with my database 
connections for authentication. It appears that periodically, the 
iSeries (DB2/400) that I connect to terminates all incoming ODBC/JDBC 
connections (one a week, apparently). What happens in my application is 
that users can no longer login after the connections have been dropped. 
The connection pool apparently doesn't try to re-initiate the 
connections after they've been dropped.

I see an exception in my logs regarding the connection being reset, then 
I see an exception relating to the pool being exhausted. I'm not 
entirely sure what the root cause of the problem here is - in theory, 
DBCP should recover gracefully when a connection is reset/dropped, right?

Here's the initial exception:
java.sql.SQLException: Communication link failure.(Connection was 
dropped unexpectedly.)
        at com.ibm.as400.access.JDError.throwSQLException(JDError.java:365)
        at 
com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.java(Compiled 
Code))
        at 
com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.java(Inlined 
Compiled Code))
        at 
com.ibm.as400.access.AS400JDBCStatement.syncRPB(AS400JDBCStatement.java(Compiled 
Code))
        at 
com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java(Compiled 
Code))
        at 
com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java(Compiled

Code))
        at 
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java(Compiled

Code))
        at 
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java(Compiled

Code))
        at 
org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java(Compiled

Code))
        at 
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java(Compiled

Code))
        at 
org.apache.catalina.realm.DataSourceRealm.credentials(DataSourceRealm.java:460)
[snip]

Here's the next one:
2004-12-06 04:39:21 DataSourceRealm[]: Exception performing authentication
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, 
pool exhausted
        at 
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java(Compiled 
Code))
        at 
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java(Compiled 
Code))
        at 
org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:438)
        at 
org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:277)
[snip]

So, what I've done now to see if it helps matters any, is specify the 
AS400's own connection pool factory in my JNDI definition, like so:

      <parameter>
        <name>factory></name>
        
<value>com.ibm.as400.access.AS400JDBCConnectionPoolDataSource</value>
      </parameter>

Both Tomcat's form authentication as well as my application (through 
iBATiS) use this JNDI DataSource for connections.

Can anyone shed more light on what the root cause of the problem is 
here? Should DBCP gracefully recover?

Regards,
Brice Ruth

-- 
Brice Ruth, Sr. IT Analyst
Fiskars Brands Inc
http://www.fiskarsbrands.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message