db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Zeidler" <tor...@christianzeidler.net>
Subject Torque and Tomcat - connection pool Exception
Date Thu, 06 May 2004 13:40:43 GMT

I've got a problem getting Torque to work inside a servlet in a Tomcat
environment: I will try to describe the situation as good as I can. Thanks
for your help!

I've succeeded in getting Torque to generate classes and SQL files according
to my schema - and with the help of some information from this mailing-list
I have also succeeded in building a small class that uses Torque and
performs an Insert and a Select 

-> I've got a torque.properties file that works (at least in the IDE
Here are the database settings that I use:

torque.database.default= bookstore
torque.database.bookstore.adapter= mysql

Using commons-dbcp 
torque.dsfactory.bookstore.connection.driver = org.gjt.mm.mysql.Driver 
torque.dsfactory.bookstore.connection.url =
torque.dsfactory.bookstore.connection.user = torque_test
torque.dsfactory.bookstore.connection.password = ;-)

The runtime usage of Torque works within a class that runs inside my eclipse
IDE with all the jar files from the torque-3.1\lib added to the build path.
The three Methods that I use for testing are: (these methods work fine when
testing from inside eclipse, of course, using a System.out.println() rather
than the PrintWriter that I use for testing on Tomcat)

public static void checkTorque(PrintWriter out){
		out.println("Is Torque initiated?  ... "+Torque.isInit());


public static void read(PrintWriter out ) {
		Criteria crit = new Criteria();
			List v = BookPeer.doSelect(crit);
			out.println("<br> Read seems to work");
		}catch(TorqueException e){
			out.println("<br> Read: "+e);

public static void insert(PrintWriter out ){
		Author bloch = new Author();
		bloch.setFirstName("testing " + System.currentTimeMillis());
		  out.println("<br> Insert seems to work");
	      }catch(Exception e){
		 	out.println("<br> Insert: "+e);

When I run the same methods (using the same torque.properties) from within a
servlet (all the jar files in the shared lib folder of the server), I get

- The Torque.isInit() works fine and returns 'true'
- But the read and insert tests both return:
'org.apache.torque.TorqueException: Could not retrieve connection info from
- If I use the Author.save() method instead of the
AuthorPeer.doInsert(Author), I get a NullPointerException

Does somebody know what I'm doing wrong? I'm really a newbie on the Tomcat
server, so it could be something quite basic... maybe...

Thanks again for your help!

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

View raw message