tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: JDBCRealm.getRoles causes NullPointerException
Date Tue, 16 Sep 2008 05:00:58 GMT
Thank you Chris.

Mark suggested it was probably:

I am using  <Realm className="org.apache.catalina.realm.JDBCRealm" ... >

I don't know what's required to use a DataSourceRealm (yet), but if  
it's a simple switch I'll try it.

I am not sharing anything; the database is used for authentication  
only.  I've declared the realm, but I don't think there's any pool  

I don't know how to set up a "validation query" or "debugging options  
for leaked connections".  I see the problem occur just after  
restarting tomcat so leaked connections shouldn't be the problem.

The odd thing is that it has run for 10 days, then it just fails, and  
then fails after restarting Tomcat.  That makes it really hard to  
isolate the cause.


Lloyd Chambers

[Mac OS X 10.5.2 Intel, Tomcat 6.0.16]

On Sep 3, 2008, at 9:39 AM, Christopher Schultz wrote:

> Hash: SHA1
> Lloyd,
>> MySQL 5.0.51b + mysql-connector-java-5.1.6-bin.jar
> Have you tried downgrading to a 5.0 version? It might be worth it to  
> see
> if there is some weird problem with their new driver.
>> The only clue I see in catalina.out is the stack trace below (10 of  
>> them
>> or so), about 9 hours *prior* to my detecting the authentication
>> failure.  However, my access logs show that users logged in  
>> successfully
>> *after* that series of failures.
> That indicates to me that you are using multiple connections to the
> database, and perhaps one of them gets damaged but the others are  
> okay.
> Do you see any other JDBC-related exceptions on your logs, or any  
> faults
> detected on the MySQL-server-side?
> Are you using a DataSourceRealm? If so, are you sharing that  
> DataSource
> with your actual application, or do you have a separate one for
> authentication?
> Any other problems /not/ related to authentication?
> Do you have a validationQuery set for your JDBC/JNDI <Resource>? If  
> so,
> what is it? Also, do you have the debugging options for leaked
> connections turned on?
>> I'm not sure where or how to debug this further.  It seems that  
>> Tomcat
>> is making a bad call to next() which causes the NPE, but that's  
>> unclear;
>> perhaps it's ResultSetImpl with a problem.  It's also unclear why
>> there's a burst of such problems, then no further ones in the log,  
>> then
>> the hours-later complete failure.
> I suspect that your connection pool is slowly failing, one  
> connection at
> a time. When you run out of useful connections, your app is dead.
>> Aug 31, 2008 5:30:48 PM org.apache.catalina.connector.CoyoteAdapter  
>> service
>> SEVERE: An exception or error occurred in the container during the
>> request processing
>> java.lang.NullPointerException
>>    at
>> com 
>> .mysql.jdbc.ResultSetImpl.setRowPositionValidity( 
>> 826)
>>    at
>>    at org.apache.catalina.realm.JDBCRealm.getRoles( 
>> 632)
> I would check with MySQL as well. I've found that my reported bugs  
> never
> get fixed, but sometimes Tonci will at least get back to you ;)
> - -chris
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla -
> YTYAnjHrmxXSu2rLdE5i2YDirOtAh3tb
> =+9Cz
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message