I'm having a bit of trouble getting the code generated by Torque to actually run... The only documentation I found on this was in the Tutorial and I've followed that, but I keep getting exceptions. I'm using Torque 3.0b4, BTW.
The first problem is that Torque fails to load the database driver, with the
message
[main] ERROR org.apache.torque.adapter.DBFactory -
java.lang.ClassNotFoundException: org.apache.torque.adapter.null
Which is followed by a StringIndexOutOfBoundsException. I managed to fix
that by changing the following configuration
services.DatabaseService.database.adapter=DBPostgres
services.DatabaseService.database.adapter.DBPostgres=org.postgresql.Driver
To
services.DatabaseService.database.foo.adapter=DBPostgres
services.DatabaseService.database.foo.adapter.DBPostgres=
org.postgresql.Driver
But now it's followed by a 'InstantiationException: Unknown JDBC driver:
DBPostgres: Check your configuration file' so I changed the configuration to
services.DatabaseService.database.adapter=org.postgresql.Driver
That gives me the following output
2002-10-06 20:10:32,195 [main] INFO org.apache.torque.Torque - Logging has
been configured by Torque.
2002-10-06 20:10:33,097 [main] WARN org.apache.torque.oid.IDBroker -
IDBroker is being used with db 'ss', which does not support transactions.
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.
Exception in thread "main" java.lang.NullPointerException: There was no
DataSourceFactory configured for the connection ss
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 net.holoweb.ss.db.BaseSsUser.save(Unknown Source)
at net.holoweb.ss.db.BaseSsUser.save(Unknown Source)
at net.holoweb.ss.dbtools.Try.main(Unknown Source)
I suspect I'm being tripped up by changes that have occurred in Torque since
the tutorial was written :-( I tried downgrading to Torque 2.1 but couldn't
figure out how to initialise that version.
What version of Torque should I be using so that the documentation will be
consistent with what I need to do? Or alternatively can someone just tell me
what I'm doing wrong?
Thanks!
L.
PS, I've attached my config and test code for reference.
torque.properties
Description: Binary data
Try.java
Description: Binary data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
