You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by goffredo <go...@twibble.org> on 2003/01/13 03:44:14 UTC
Transaction Error: Postgresql <=> Torque
Hi,
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
Regards
goffredo
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;
try
{
con = Transaction.begin(dbName);
save(con);
Transaction.commit(con);
}
catch(TorqueException e)
{
Transaction.safeRollback(con); [ <--- line 179 ]
throw e;
}
}
Last Few Lines of torque.log :
------------------------------
[...]
DEBUG - Using converter
org.apache.commons.beanutils.converters.StringConverter@3901c6
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 =
${torque.applicationRoot}/logs/torque.log
log4j.appender.org.apache.torque.layout = org.apache.log4j.PatternLayout
log4j.appender.org.apache.torque.layout.conversionPattern = %d [%t] %-5p %c - %
m%n
log4j.appender.org.apache.torque.append = false
torque.database.default=bookstore
torque.database.bookstore.adapter=postgresql
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.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.database.bookstore.driver = org.postgresql.Driver
torque.database.bookstore.url = jdbc:postgresql://192.168.1.1:5432/bookstore
torque.dsfactory.bookstore.connection.user = <user>
torque.dsfactory.bookstore.connection.password = <password>
torque.idbroker.cleverquantity=true
torque.manager.useCache = true
Solved: was: Transaction Error: Postgresql <=> Torque
Posted by goffredo <go...@twibble.org>.
Hi Steve,
Thanks for your clarification,
[...]
> It is not saying the RDBMS does not support transactions, its telling
> us, for some reason IDBroker can not use transactions with the
> db 'bookstore' it found defined in our configuration, there are
> probably many possible reasons for this but I've run into
> 1) bad configuation of the database, and 2) incorrect login
> information as the most common problems.
After checking with pg_shadow and other things, I finally found the
offending line:
torque.dsfactory.bookstore.connection.user = "goffredo"
Of course it's obvious - there should be no java-style double quotes
around the user name!! The Postgresql user is goffredo, not "goffredo"
- ah the joys of programming. ;)
Thanks
Goffredo
Re: Transaction Error: Postgresql <=> Torque
Posted by Steve Hansen <st...@sinex.com>.
Hello,
When I've seen errors like this it usually means I've miss configured
the runtime configuration file. When torque is complaining a database is
not using transactions ..
WARN - IDBroker is being used with db 'bookstore',
> which does not support transactions. <--- for Postgresql ?????It is not saying the RDBMS does not support transactions, its telling us, for some
reason IDBroker can not use transactions with the db 'bookstore' it
found defined in our configuration, there are probably many possible
reasons for this but I've run into 1) bad configuation of the database,
and 2) incorrect login information as the most common problems.
Steve
On Sun, 2003-01-12 at 20:44, goffredo wrote:
> Hi,
>
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
>
> Regards
> goffredo
>
> 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;
> try
> {
> con = Transaction.begin(dbName);
> save(con);
> Transaction.commit(con);
> }
> catch(TorqueException e)
> {
> Transaction.safeRollback(con); [ <--- line 179 ]
> throw e;
> }
>
> }
>
> Last Few Lines of torque.log :
> ------------------------------
>
> [...]
> DEBUG - Using converter
> org.apache.commons.beanutils.converters.StringConverter@3901c6
> 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 =
> ${torque.applicationRoot}/logs/torque.log
> log4j.appender.org.apache.torque.layout = org.apache.log4j.PatternLayout
> log4j.appender.org.apache.torque.layout.conversionPattern = %d [%t] %-5p %c - %
> m%n
> log4j.appender.org.apache.torque.append = false
>
> torque.database.default=bookstore
> torque.database.bookstore.adapter=postgresql
>
> 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.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.database.bookstore.driver = org.postgresql.Driver
> torque.database.bookstore.url = jdbc:postgresql://192.168.1.1:5432/bookstore
> torque.dsfactory.bookstore.connection.user = <user>
> torque.dsfactory.bookstore.connection.password = <password>
>
> torque.idbroker.cleverquantity=true
> torque.manager.useCache = true
>
>
>
>
>
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>