db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kalén <mka...@apache.org>
Subject Re: java.lang.NullPointerException after calling getCollectionFromQuery()
Date Thu, 09 Jun 2005 14:02:47 GMT
Christopher Cheng wrote:
> I found the following exception after running the web application for days.
<snip/>
> Caused by: java.lang.NullPointerException
>             at com.jnetdirect.jsql.am.clearParameters(Unknown Source)

This is a JDBC-driver exception and is probably caused by a server-side dropped
Connection object getting reused from pool due to a missing validation query.

You need a validation query for your connection pool to avoid this.

Since you are using a DataSource, you cannot directly specify the validation
query in OJB - instead you will have to configure you DataSource to use it.

However, since the concept of a validation query also applies when using
OJB connection pooling you can google for [ojb "validation query"] to get
some recent user-list discussions regarding this.

A direct link to a recent thread:
  http://www.mail-archive.com/ojb-user@db.apache.org/msg13521.html

You can use the same validation query (ie "SELECT 1") for MS SQL Server
as the specified MySQL example.


Since your stacktrace shows "com.caucho.sql" I take it that you use
Resin for your DataSource definition and connection pooling?

If so, check Resin docs for how to configure the validation query:
  http://www.caucho.com/resin-3.0/db/config.xtp#Core-Configuration
  http://www.caucho.com/resin-3.0/db/config.xtp#reliability

(The concept of performing 'validation queries' seems to be called
"pinging" in Caucho terminology. It also seems that ping="true" equals
Apache Commons Pool setting of testOnBorrow="true".)

Regards,
  Martin


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


Mime
View raw message