db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Moiseyev <ser...@peoplelogic.com.au>
Subject Re: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection bookstore
Date Mon, 27 Oct 2003 02:53:07 GMT
Hi David

Try to add the following lines to your property file:

torque.dsfactory.bookstore.factory=org.apache.torque.dsfactory.TorqueDataSourceFactory
torque.dsfactory.bookstore.pool.defaultMaxConnections=10
torque.dsfactory.bookstore.pool.maxExpiryTime=3600
torque.dsfactory.bookstore.pool.connectionWaitTimeout=10
torque.dsfactory.bookstore.connection.driver = org.gjt.mm.mysql.Driver
torque.dsfactory.bookstore.connection.url = jdbc:mysql://127.0.0.1/bookstore
torque.dsfactory.bookstore.connection.user =
torque.dsfactory.bookstore.connection.password =

This is taken from the Torque.properties file which is located int the 
root directory of the torque-3.1  distribution.

Cheers,

Sergey

David Chelimsky wrote:

>Hi. I believe that I'm following the tutorial (http://db.apache.org/torque/tutorial) to
the letter, but when I get to executing the Bookstore program (java com.kazmier.Bookstore),
I get the following message:
>
>java.lang.NullPointerException: There was no DataSourceFactory configured for the connection
bookstore
>        at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:749)
>        at org.apache.torque.Torque.getConnection(Torque.java:306)
>        at org.apache.torque.util.Transaction.beginOptional(Transaction.java:118)
>        at org.apache.torque.util.Transaction.begin(Transaction.java:100)
>        at com.kazmier.om.BasePublisher.save(BasePublisher.java:490)
>        at com.kazmier.om.BasePublisher.save(BasePublisher.java:471)
>        at com.kazmier.Bookstore.main(Bookstore.java:26)
>
>Note that at this point, I can see that the object model and various sql files are correctly
created AND I can see that the database and relevant tables have been created. So I think
that something is working at build time that is failing at run time.
>
>Here's build.properties:
>========================================================
>torque.jar = torque-3.1.jar
>torque.project = bookstore
>torque.database = mysql
>torque.targetPackage = com.kazmier.om
>torque.database.createUrl = jdbc:mysql://127.0.0.1:3306/mysql
>torque.database.buildUrl = jdbc:mysql://127.0.0.1:3306/bookstore
>torque.database.url = jdbc:mysql://127.0.0.1:3306/bookstore
>torque.database.driver = org.gjt.mm.mysql.Driver
>torque.database.user =
>torque.database.password =
>torque.database.host = 127.0.0.1
>========================================================
>
>And here's Torque.properties
>========================================================
>log4j.rootCategory = DEBUG, default
>log4j.appender.default = org.apache.log4j.FileAppender
>log4j.appender.default.file = ./torque.log
>log4j.appender.default.layout = org.apache.log4j.SimpleLayout
>
>torque.database.default = bookstore
>torque.database.bookstore.driver = org.gjt.mm.mysql.Driver
>torque.database.bookstore.url = jdbc:mysql://127.0.0.1:3306/bookstore
>torque.database.bookstore.username = 
>torque.database.bookstore.password =
>========================================================
>  
>



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


Mime
View raw message