Nissim wrote:
>
> Hi All,
>
> I'm trying to use the DB Connection pool from Turbine in my
> application. The code in my servlet looks like this:
>
> ...
> import org.apache.turbine.util.db.pool.*;
> ...
>
> try {
> //Get a connection from the global DB broker
> DBConnection db =
> DBBroker.getInstance().getConnection("postgresql.Driver",
>
> "jdbc:postgresql:nonemp",
> "nissim",
> "passwd");
> Connection connG = db.getConnection();
> out.println(Section.getSectionList(connG, null));
> DBBroker.getInstance().releaseConnection(db);
> }
> catch (Exception e) {
> e.printStackTrace(out);
> }
>
> ...
>
> The first time the servlet is called, the log shows an
> ExceptionInInitializerError, and all of the following times, a
> NoClassDefFoundError. The log looks like this:
>
> [23/02/2000 09:25:50:334 EST] java.lang.ExceptionInInitializerError
> at
> org.apache.jserv.JServConnection.processRequest(JServConnection.java:320)
> at
> org.apache.jserv.JServConnection.run(JServConnection.java:188)
> at java.lang.Thread.run(Thread.java)
> [23/02/2000 09:26:10:350 EST] java.lang.NoClassDefFoundError:
> org/apache/turbine/util/db/pool/DBFactory
> at
> org.apache.jserv.JServConnection.processRequest(JServConnection.java:320)
> at
> org.apache.jserv.JServConnection.run(JServConnection.java:188)
> at java.lang.Thread.run(Thread.java)
>
The ExceptionInInitializerError is the real problem. It means that
there's an uncaught exception in the static{} code in the
DBFactory.java. The problem comes from the TurbineResources not knowing
where to look for the initialization file. so to use the Turbine code,
outside of turbine you have to:
import import org.apache.turbine.util.*; //maybe just TurbineResources
is OK
and then before using turbine code do
TurbineResources.setPropertiesFileName("/path/to/TurbineResources.properties");
Maybe this should be in the FAQ.
-Nissim
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]