Hi again,

I realize I haven't got any replies to my question. Maybe the question 
was stupid? Well, nonetheless I've solved the problem now. Posting the 
solution here so that others may avoid this newbie problem.

Stein Inge Morisbak wrote:
> Hi,
> 
> I've tried to get the example application bookstore as described at 
> http://jakarta.apache.org/turbine/torque/tutorial.html to work.
> 
> The following is the output from running the application using the test 
> class Bookstore.
> 
> ----------- snip -----------------
> java.lang.NullPointerException: There was no DataSourceFactory 
> configured for the connection bookstore
>     at org.apache.torque.Torque.getConnection(Torque.java:924)
>     at 
> org.apache.torque.util.Transaction.beginOptional(Transaction.java:113)
>     at org.apache.torque.util.Transaction.begin(Transaction.java:97)
>     at com.kazmier.om.BasePublisher.save(BasePublisher.java:428)
>     at com.kazmier.om.BasePublisher.save(BasePublisher.java:412)
>     at com.kazmier.Bookstore.main(Bookstore.java:26)
> Process terminated with exit code 0
> ------------ snip -----------------
> 
> The database exists with the required tables.
> 
> I've copied the code and properties directly from the web-page, but 
> include my Torque.properties anyway.
> 
> ----------- snip -----------------
> torque.database.default=bookstore
> torque.database.bookstore.driver = org.gjt.mm.mysql.Driver
> torque.database.bookstore.url = jdbc:mysql://127.0.0.1/bookstore
> torque.database.bookstore.username = myusr
> torque.database.bookstore.password = mypasswd
> ------------ snip -----------------

In my Torque.properties file I added the following dsfactory settings:

------------ snip -----------------
torque.dsfactory.bookstore.factory=org.apache.torque.dsfactory.Jdbc2PoolDataSourceFactory
torque.dsfactory.bookstore.pool.defaultMaxActive=10
torque.dsfactory.bookstore.pool.testOnBorrow=true
torque.dsfactory.bookstore.pool.validationQuery=SELECT 1
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 = myusr
torque.dsfactory.bookstore.connection.password = mypasswd
------------ snip -----------------

Regards,
Stein Inge Morisbak


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to