db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From goffredo <goffr...@twibble.org>
Subject Transaction Error: Postgresql <=> Torque
Date Mon, 13 Jan 2003 02:44:14 GMT

I am working through the bookstore tutorial, and am making some
progress. If people think it's ok, I could make my notes available
for inclusion in the tutorial - there are database specific things
that are important, that are not mentioned. For example, I still
haven't been able to get torque to create-db the 'bookstore' database
for me, so I did it by hand, then the loading of the db seemed
to go ok. Next I embedded the torque source tree into CodeGuide (an IDE) 
as a new project and created the tutorial application. It compiled
fine. But when I tried to run it I got a mysterious error, a warning
in the torque.log stating that the Postgresql 'bookstore' database
does not support transactions (???) Of course Postgresql supports
transactions ... I am not sure at all where the problem lies - my
configuration, my startup of Postgresql - or what - I enclose the 
relevant notes, perhaps someone can spot the fault right away ... and
let me know 


Error Message :

java.lang.NullPointerException: Connection object was null.
 This could be due to a misconfiguration of the DataSourceFactory.
 Check the logs and Torque.properties to better determine the cause.
    at org.apache.torque.util.Transaction.rollback(Transaction.java:179)
    at org.apache.torque.util.Transaction.safeRollback(Transaction.java:221)
    at org.armida.mbrowser.torque.om.BasePublisher.save(BasePublisher.java:426)
    at org.armida.mbrowser.torque.om.BasePublisher.save(BasePublisher.java:401)
    at Bookstore.main(Bookstore.java:26)

Offending Class :
    public void save(String dbName) throws TorqueException
        Connection con = null;
            con = Transaction.begin(dbName);
        catch(TorqueException e)
            Transaction.safeRollback(con);    [ <--- line 179 ]
            throw e;


Last Few Lines of torque.log :

DEBUG -   Using converter 
DEBUG - Adding a dummy entry for default, mapped onto bookstore
DEBUG - IDBroker thread was started.
WARN - IDBroker is being used with db 'bookstore',
 which does not support transactions.                 <--- for Postgresql ??????
 IDBroker attempts to use transactions to limit the
 possibility of duplicate key generation.  Without
 transactions, duplicate key generation is possible
 if multiple JVMs are used or other means are used to
 write to the database.

torque.properties :

torque.applicationRoot = .

log4j.category.org.apache.torque = ALL, org.apache.torque
log4j.appender.org.apache.torque = org.apache.log4j.FileAppender
log4j.appender.org.apache.torque.file = 
log4j.appender.org.apache.torque.layout = org.apache.log4j.PatternLayout
log4j.appender.org.apache.torque.layout.conversionPattern = %d [%t] %-5p %c - %
log4j.appender.org.apache.torque.append = false


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

## Using Jdbc2Pool
torque.dsfactory.bookstore.pool.validationQuery=SELECT 1
torque.database.bookstore.driver = org.postgresql.Driver
torque.database.bookstore.url = jdbc:postgresql://
torque.dsfactory.bookstore.connection.user = <user>
torque.dsfactory.bookstore.connection.password = <password>

torque.manager.useCache = true

View raw message