I have been trying to setup Torque running on Caucho Resin. I successfully
ran the Torque sample app via static main function. Then I moved my Torque
folders and files to /WEB-INF. I created an init servlet to initialize
Torque upon starting Resin and edited my resin conf file to load it:
<servlet>
<servlet-name>InitServlet</servlet-name>
<servlet-class>com.notsleepy.servlets.InitServlet</servlet-class>
<init-param config='/WEB-INF/build.properties'/>
<init-param debug='2'/>
<load-on-startup>10</load-on-startup>
</servlet>
It seems to initialize fine. The problem comes when I try to access the
database. I try a simple insert and the following exception spews:
ERROR in BookActions.doPost
java.lang.NullPointerException: There was no DataSourceFactory configured
for th
e 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
org.apache.torque.BaseBook.save(D:/projects/torquetest/torque-3.0-b4/
src/java/org/apache/torque/BaseBook.java:530)
I have checked and re-checked my build.properties, id-table-schema.xml, and
project-schema.xml. Much thanks in advance to anyone who can help. Oh and
I have also added commons-dbcp-1.0-dev-20020806.jar to WEB-INF/lib. Here is
my build.properties:
torque.project = bookstore
torque.database = mysql
torque.targetPackage = org.apache.torque
torque.addGetByNameMethod = true
torque.addIntakeRetrievable = false
torque.addSaveMethod = true
torque.addTimeStamp = true
torque.basePrefix = Base
torque.complexObjectModel = true
torque.overloadKeySetters = true
torque.useClasspath = false
torque.useManagers = false
torque.database.createUrl = jdbc:mysql://127.0.0.1/mysql
torque.database.buildUrl = jdbc:mysql://127.0.0.1/bookstore
torque.database.url = jdbc:mysql://127.0.0.1/bookstore
torque.database.driver = org.gjt.mm.mysql.Driver
torque.database.user = mysql
torque.database.password =
torque.database.host = 127.0.0.1
torque.database.name = bookstore
torque.database.default=default
torque.database.default.adapter=mysql
torque.dsfactory.default.factory=org.apache.torque.dsfactory.TorqueDataSourc
eFactory
torque.dsfactory.default.pool.defaultMaxConnections=10
torque.dsfactory.default.pool.maxExpiryTime=3600
torque.dsfactory.default.pool.connectionWaitTimeout=10
torque.dsfactory.default.connection.driver = org.gjt.mm.mysql.Driver
torque.dsfactory.default.connection.url = jdbc:mysql://127.0.0.1/bookstore
torque.dsfactory.default.connection.user = mysql
torque.dsfactory.default.connection.password =
torque.sameJavaName = false
Tony Spencer
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>