To learn Torque, I went through the tutorial, and I'm getting an error at the final step that I can't seem to fix. I'm trying to run Torque on RedHat Linux 9.0-Plesk 6.0 with J2SDK 1.4.2 and MySQL 3.23. I get a SQLException that looks like it's resulting from Torque.init() not reading my Torque.properties file correctly. A funny thing is that even though the SQLException says it can't connect to the db, the "ant -f build-torque.xml create-db" and table-init steps work fine. I get a similar SQLException when running Torque programmatically from a test webapp running under Resin 4.0. Have I forgotten to configure something or to install a critical jar?
Pasted below are the debug output from the "java com.kazmier.Bookstore" command at the end of the tutorial and my Torque.properties file (which resides at the top level of my torque-tutorial directory hierarchy). Can a Torque guru or someone who's had a similar problem or someone who has an idea about what to try next respond with some troubleshooting ideas?
So far I've tried ...
* (Of course) Backtracking all my work on the tutorial to make sure I didn't have any typos, etc. (which isn't to say that I'm 100-percent sure my configs are typo-free)
* Swapping localhost/127.0.0.1 in the db url
* Trying a couple of different admin-level db users
* Tweaking the Torque.properties file to use org.apache.torque.dsfactory.SharedPoolDataSourceFactory
* Uncommenting the "tableType = MyISAM" line in templates/sql/base/mysql/db.props file
My next step would be to try to suss out whether some of my jars were old/bad versions ... but I just don't know Torque that well to be able to tell. Any help would be greatly appreciated!
Sincerely, Rob Pratt [EMAIL PROTECTED]
<runtime output>
[DEBUG] TorqueInstance - -init(Torque.properties)
[DEBUG] TorqueInstance - -Config Object is [EMAIL PROTECTED]
[DEBUG] TorqueInstance - -init([EMAIL PROTECTED])
[DEBUG] TorqueInstance - - setConfiguration(org.apache.commons.configuration.PropertiesConfiguratio [EMAIL PROTECTED])
[DEBUG] TorqueInstance - -initialize()
[DEBUG] TorqueInstance - - setConfiguration([EMAIL PROTECTED] 050)
[DEBUG] TorqueInstance - - initAdapters([EMAIL PROTECTED])
[WARN] TorqueInstance - -No Database definitions found!
[DEBUG] TorqueInstance - - initDataSourceFactories(org.apache.commons.configuration.BaseConfigurati [EMAIL PROTECTED])
[DEBUG] TorqueInstance - -handle: bookstore DataSourceFactory: org.apache.torque.dsfactory.SharedPoolDataSourceFactory
[DEBUG] AbstractDataSourceFactory - -Starting initCPDS
[DEBUG] TorqueInstance - -getConfiguration() = [EMAIL PROTECTED]
[DEBUG] AbstractDataSourceFactory - -applyConfiguration(null, [EMAIL PROTECTED])
[DEBUG] AbstractDataSourceFactory - - applyConfiguration([EMAIL PROTECTED] b1db0, [EMAIL PROTECTED])
[ERROR] AbstractDataSourceFactory - -Property: driver value: org.gjt.mm.mysql.Driver is not supported by DataSource: org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
[ERROR] AbstractDataSourceFactory - -Property: url value: jdbc:mysql://localhost:3306/bookstore is not supported by DataSource: org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
[ERROR] AbstractDataSourceFactory - -Property: username value: wssib is not supported by DataSource: org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
[ERROR] AbstractDataSourceFactory - -Property: password value: 6rjr1rj( is not supported by DataSource: org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
[DEBUG] SharedPoolDataSourceFactory - -Starting initJdbc2Pool
[DEBUG] TorqueInstance - -getConfiguration() = [EMAIL PROTECTED]
[DEBUG] AbstractDataSourceFactory - -applyConfiguration(null, [EMAIL PROTECTED])
[DEBUG] AbstractDataSourceFactory - - applyConfiguration([EMAIL PROTECTED] e9a30, [EMAIL PROTECTED])
[ERROR] AbstractDataSourceFactory - -Property: defaultMaxActive value: 30 is not supported by DataSource: org.apache.commons.dbcp.datasources.SharedPoolDataSource
[DEBUG] ConvertUtils - -Convert string 'true' to class 'boolean'
[ERROR] AbstractDataSourceFactory - -Property: testOnBorrow value: true is not supported by DataSource: org.apache.commons.dbcp.datasources.SharedPoolDataSource
[DEBUG] ConvertUtils - -Convert string 'SELECT 1' to class 'java.lang.String'
[ERROR] AbstractDataSourceFactory - -Property: validationQuery value: SELECT 1 is not supported by DataSource: org.apache.commons.dbcp.datasources.SharedPoolDataSource
[DEBUG] TorqueInstance - -getConfiguration() = [EMAIL PROTECTED]
[DEBUG] IDBroker - -IDBroker thread was started.
[WARN] IDBroker - -IDBroker is being used with db 'bookstore', 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.
[DEBUG] Transaction - -called safeRollback with null argument
java.sql.SQLException: Driver not found for URL: null
at 0x40268e17: java.lang.Throwable.Throwable(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x4025bcd2: java.lang.Exception.Exception(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x402fce64: java.sql.SQLException.SQLException(java.lang.String, java.lang.String, int) (/usr/lib/./libgcj.so.3)
at 0x402fce14: java.sql.SQLException.SQLException(java.lang.String) (/usr/lib/./libgcj.so.3)
at 0x402fccd2: java.sql.DriverManager.getConnection(java.lang.String, java.util.Properties) (/usr/lib/./libgcj.so.3)
at 0x402fcc0e: java.sql.DriverManager.getConnection(java.lang.String, java.lang.String, java.lang.String) (/usr/lib/./libgcj.so.3)
-- SNIP: More stack trace available if it may prove useful --
</runtime output>
<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.dsfactory.bookstore.factory=org.apache.torque.dsfactory.SharedPoo lDataSourceFactory
torque.dsfactory.bookstore.pool.defaultMaxActive=30
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://localhost:3306/bookstore
torque.dsfactory.bookstore.connection.username = wssib
torque.dsfactory.bookstore.connection.password = 6rjr1rj(
</Torque.properties>