Scott Hasse wrote:
> I started to watch JBoss' stderr (which doesn't get traced to the log file
> with my setup), and did notice the following errors. I have tried
> refreshing this many times, but still have the same problem.
>
> 2001-05-03 02:51:39 - ContextManager: JDBCRealm: The database connection is
> null or was found to be closed. Trying to re-open it.
> 2001-05-03 02:51:39 - ContextManager: JDBCRealm: There was an SQLException
> while in authenticate: null
> 2001-05-03 02:51:39 - ContextManager: JDBCRealm: SQLException: The user
> property is missing. It is mandatory.
> 2001-05-03 02:51:40 - ContextManager: JDBCRealm: The database connection is
> null or was found to be closed. Trying to re-open it.
> 2001-05-03 02:51:40 - ContextManager: JDBCRealm: There was an SQLException
> while in authenticate: test
> 2001-05-03 02:51:40 - ContextManager: JDBCRealm: SQLException: The user
> property is missing. It is mandatory.
>
> Scott
hi scott!!
i had to write my own JDBCRealm for tomcat because i wanted to be able
to connect to different databases depending on the web application that
is running. so i took a look on the original JDBCRealm source and
discovered the following lines:
/**
* If there are any errors with the JDBC connection, executing
* the query or anything we return false (don't authenticate). This
* event is also logged.
*
* If there is some SQL exception the connection is set to null.
* This will allow a retry on the next auth attempt. This might not
* be the best thing to do but it will keep tomcat from needing a
* restart if the database goes down.
*
* @param username Username of the Principal to look up
* @param credentials Password or other credentials to use in
* authenticating this username
*/
public synchronized boolean authenticate(String username, String
credentials) {
try {
// Establish the database connection if necessary
if ((dbConnection == null) || dbConnection.isClosed()) {
log(sm.getString("jdbcRealm.authDBClosed"));
dbConnection = DriverManager.getConnection(connectionURL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^
if( (dbConnection == null) || dbConnection.isClosed() ) {
log(sm.getString("jdbcRealm.authDBReOpenFail"));
return false;
}
dbConnection.setReadOnly(true);
}
obviously, if the connection did close (due redeployment, for example) a
new connection is catched, but they forgot to pass a user and password
when getting a new connection!!!
the same code fragment is in the method public synchronized String[]
getUserRoles(String username).
so the only way to fix your problem is to fix the broken code in
org.apache.tomcat.request.JDBCRealm.
maybe someone should repost this message to a tomcat-dev list or
whatever, i'm not sure where to cross-post it to.
patrick
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user