db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Yu <Benjam...@InformativeResearch.com>
Subject RE: Torque on Tomcat: Exception: DataSourceFactory not configure d
Date Mon, 15 Mar 2004 20:12:30 GMT
How does struts initialize Torque? Is there such a method?

For me, I use an init servlet to load the Torque properties that
is loaded on startup. I can't remember where in the docs that
I read this suggestion.

Eg:

public final void init() {
        String prefix = getServletContext().getRealPath("/");
        String file = getInitParameter("torque-init-file");
        if (file != null) {
            try {
                Torque.init(prefix + file);
            } catch (TorqueException e) {
                Logger.getInstance(TorqueInitServlet.class).fatal(
                    "Cannot Init Torque",
                    e);
            }
        }
    }

I know if I don't have that piece of code running at startup, the
config file won't get pulled in and I get the same error message
you've got.

-Ben

-----Original Message-----
From: Drake Philbrook [mailto:dsp@graphtek.com]
Sent: Monday, March 15, 2004 11:48 AM
To: Apache Torque Users List
Subject: RE: Torque on Tomcat: Exception: DataSourceFactory not
configured 


Hi,

More Background... I am using Torque with Struts.  I already have a
working datasource enabled thru struts-config.xml.  Can I tell Torque to
use the existing datasource?  I tried...

torque.dsfactory.bookstore.factory=org.apache.torque.dsfactory.JndiDataS
ourceFactory
torque.dsfactory.bookstore.jndi.path=jdbc:mysql://localhost/cms-cms

But that didn't have any effect on the error.  

Also, from a best practices standpoint, any recommendations for the
Struts / Torque / Tomcat4 / MySql topology? 

Drake


-----Original Message-----
From: Drake Philbrook [mailto:dsp@graphtek.com] 
Sent: Monday, March 15, 2004 11:25 AM
To: Apache Torque Users List
Subject: RE: Torque on Tomcat: Exception: DataSourceFactory not
configured 

Hi,

I am still getting the same error.  

DEBUG Ajp13Processor[8009][4] com.dsp.cms.torque.UsersPeer - Enter
UsersPeer.addUser DEBUG Ajp13Processor[8009][4]
com.dsp.cms.torque.UsersPeer - UsersPeer.addUser Exception:
java.lang.NullPointerException: There was no DataSourceFactory
configured for the connection cms-cms DEBUG Ajp13Processor[8009][4]
com.dsp.cms.torque.UsersPeer - Exit UsersPeer.addUser

I updated my Torque.properties using the following...

log4j.rootCategory=DEBUG, default
log4j.appender.default=org.apache.log4j.RollingFileAppender
log4j.appender.default.MaxFileSize=1024KB
log4j.appender.default.file=/var/tomcat4/logs/torque.log
log4j.appender.default.MaxBackupIndex=1
log4j.appender.default.layout = org.apache.log4j.SimpleLayout

torque.database.default = cms-cms
torque.database.cms-cms.adapter = mysql
torque.database.cms-cms.driver = org.gjt.mm.mysql.Driver
torque.database.cms-cms.url = jdbc:mysql://127.0.0.1/cms-cms
torque.database.cms-cms.username = admin
torque.database.cms-cms.password = cms

torque.dsfactory.cms-cms.factory=org.apache.torque.dsfactory.SharedPoolD
ataSourceFactory
#torque.dsfactory.cms-cms.factory=org.apache.torque.dsfactory.PerUserPoo
lDataSourceFactory

torque.dsfactory.cms-cms.pool.defaultMaxActive=30
torque.dsfactory.cms-cms.pool.testOnBorrow=true
torque.dsfactory.cms-cms.pool.validationQuery=SELECT 1

torque.dsfactory.cms-cms.connection.driver = org.gjt.mm.mysql.Driver
torque.dsfactory.cms-cms.connection.url = jdbc:mysql://127.0.0.1/cms-cms
torque.dsfactory.cms-cms.connection.user = admin
torque.dsfactory.cms-cms.connection.password = cms

Any ideas?

Drake
 

-----Original Message-----
From: Femi Aluko [mailto:ifemi78@yahoo.com]
Sent: Monday, March 15, 2004 8:07 AM
To: Apache Torque Users List
Subject: Re: Torque on Tomcat: Exception: DataSourceFactory not
configured 

Hello Drake,
 
  You did not set the datasource configurations in the Torque.properties
file.
  If u would be using commons-dbcp  just uncomment and set all the
values under the heading .
 
here is a sample 
 

## Using commons-dbcp 

torque.dsfactory.hospital.factory=org.apache.torque.dsfactory.SharedPool
DataSourceFactory

torque.dsfactory.hospital.factory=org.apache.torque.dsfactory.PerUserPoo
lDataSourceFactory

#torque.dsfactory.hospital.pool.defaultMaxActive=10

#torque.dsfactory.hospital.pool.testOnBorrow=true

#torque.dsfactory.hospital.pool.validationQuery=SELECT 1

torque.dsfactory.hospital.connection.driver = org.gjt.mm.mysql.Driver

torque.dsfactory.hospital.connection.url =
jdbc:mysql://localhost:3306/bookstore

torque.dsfactory.hospital.connection.user = ur value

torque.dsfactory.hospital.connection.password = ur value

 

 

 

Drake Philbrook <dsp@graphtek.com> wrote:
Hi,

System:

RedHat Linux Enterprise V3
MySql V3.23
Tomcat 4.0.6

I followed the instructions to install Torque in a Web Application
running on Tomcat4 that I found at
http://javaxp.netfirms.com/torque-jstl.html.

I see these entries during initialization:

[DEBUG] TorqueInstance -
-init(org.apache.commons.configuration.PropertiesConfiguration@64857a17)
[DEBUG] TorqueInstance -
-setConfiguration(org.apache.commons.configuration.PropertiesConfigurati
on@64857a17)
[DEBUG] TorqueInstance - -initialize()
[DEBUG] TorqueInstance -
-setConfiguration(org.apache.commons.configuration.BaseConfiguration@26d
c3a17)
[DEBUG] TorqueInstance -
-initAdapters(org.apache.commons.configuration.BaseConfiguration@26dc3a1
7)
[WARN] TorqueInstance - -Databases defined but no adapter configurations
found!
[DEBUG] TorqueInstance -
-initDataSourceFactories(org.apache.commons.configuration.BaseConfigurat
ion@26dc3a17)
[DEBUG] TorqueInstance - -Adding a dummy entry for default, mapped onto
cms-cms Ajp13Connector[8009] Opening server socket on host IP address
127.0.0.1

When I try to make a Torque call, I get this output:

[DEBUG] TorqueInstance - -getConfiguration() =
org.apache.commons.configuration.BaseConfiguration@26dc3a17
[DEBUG] IDBroker - -IDBroker thread was started.
[WARN] IDBroker - -IDBroker is being used with db 'cms-cms', 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 Ajp13Processor[8009][2] com.dsp.cms.torque.UsersPeer -
UsersPeer.addUser Exception: java.lang.NullPointerException: There was
no DataSourceFactory configured for the connection cms-cms

Any help is appreciated.

BTW: Is there a searchable list of issues about Torque? Maybe these
issues have been resolved and I just can't find the answers.

Drake


*************************************************
Drake Philbrook
Graphtek
73241 Hwy 111
Suite 2B
Palm Desert, CA 92260
760-341-4583 - Office
760-898-4413 - Cell
760-341-9285 - Fax
dsp@graphtek.com - Email
*************************************************




Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message