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 Jenny Brown <je...@bigbrother.net> on 2003/04/03 19:55:24 UTC

problem configuring data source

I'm using Torque stand-alone, and am having trouble getting the
data source factory configuration set up right.  Here's what I'm
seeing:

DEBUG Thread-22 org.apache.torque.Torque (Torque.java:318) - handle:
 defaults DataSourceFactory: org.apache.torque.dsfactory.TorqueDataSourceFactory
DEBUG Thread-22 org.apache.torque.dsfactory.TorqueDataSourceFactory
  (TorqueDataSourceFactory.java:124) - Starting initCPDS

ERROR Thread-22 org.apache.torque.dsfactory.TorqueDataSourceFactory
(TorqueDataSourceFactory.java:139) - java.lang.NullPointerException at
 org.apache.torque.dsfactory.TorqueDataSourceFactory.initCPDS(TorqueDataSourceFactory.java:129) at

 org.apache.torque.dsfactory.TorqueDataSourceFactory.initialize(TorqueDataSourceFactory.java:108) at
 org.apache.torque.Torque.initDataSourceFactories(Torque.java:323) at
 org.apache.torque.Torque.initialize(Torque.java:237) at
 org.apache.torque.Torque.init(Torque.java:406) at
 org.apache.torque.Torque.init(Torque.java:386) at
 HelperServlet.handleRequest(HelperServlet.java:109) at
 org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:372)
 ...  [more snipped]


I've tried setting all kinds of properties file keys for connections and
pools and yet thing null pointer keeps appearing.  I tried looking into
the source xreference on the site for clues but it seems to be out of
date; the line numbers don't match anything meaningful.

The result of this is that Torque can't get connection to the database,
which really limits its functionality (it works in most areas if I
pass my own connection in, but some functions don't allow that).

I'm really stuck on this, can't figure out what I am doing wrong that
the data source factory won't configure/init properly.

Ant can connect to my database just find with its build.properties.  I'm
calling Torque.init() with a path to a Torque.properties as well.  I am
certain the configuration is being read into torque because I can loop
through the keys and see them in debugging.  But somehow I'm missing
something that the datasource wants, and I don't know what.

Jenny Brown



Re: problem configuring data source

Posted by Andras Balogh <an...@reea.net>.
----- Original Message ----- 
From: "Jenny Brown" <je...@bigbrother.net>
To: "Turbine Torque Users List" <to...@db.apache.org>
Sent: Thursday, April 03, 2003 21:44
Subject: Re: problem configuring data source


> I'm still having trouble, this time with id generation...
> 
> org.apache.torque.TorqueException: IdGenerator for table 'roll' is null
> org.apache.torque.util.BasePeer.doInsert(BasePeer.java:690)
> phototorque.BaseRollPeer.doInsert(BaseRollPeer.java:225)
> 
> 
>
..... 
> 
> 
> Jenny Brown

    Hi,

You should doublecheck your torque.properties file.
Do you have a line like this:
torque.database.photopreview.adapter=postgres
?

BW,

Andras.




Re: problem configuring data source

Posted by Jenny Brown <je...@bigbrother.net>.
I'm still having trouble, this time with id generation...

org.apache.torque.TorqueException: IdGenerator for table 'roll' is null
org.apache.torque.util.BasePeer.doInsert(BasePeer.java:690)
phototorque.BaseRollPeer.doInsert(BaseRollPeer.java:225)


This is after I got the data source connections configured and coming
up properly (turns out I needed both default and myproject keys).  I
am defining the follow from my project schema file:

<database name="photopreview" defaultIdMethod="native">
<table name="shoot" description="Photo shoots" idMethod="native">
  <column name="shoot_id" required="true" primaryKey="true"
   type="INTEGER" description="Shoot id" />
...
</database>


So I'm not sure why it's unable to create IDs for me.  I'm using
this with postgres, and 'native' seemed to work fine until this point.



Jenny Brown




Re: problem configuring data source

Posted by Jenny Brown <je...@bigbrother.net>.
Correction, I got the data source working.  The solution is to provide keys for
dsfactory which are named 'default' instead of named after my project.

Correct keys:

torque.dsfactory.default.factory=org.apache.torque.dsfactory.TorqueDataSourceFactory

torque.dsfactory.default.pool.defaultMaxConnections=10
torque.dsfactory.default.pool.maxExpiryTime=3600
torque.dsfactory.default.pool.connectionWaitTimeout=10

torque.dsfactory.default.connection.driver = org.postgresql.Driver
torque.dsfactory.default.connection.url = jdbc:postgresql://host:5432/database
torque.dsfactory.default.connection.user = username
torque.dsfactory.default.connection.password = password


Incorrect keys:

torque.dsfactory.myproject.pool.defaultMaxConnections=10
torque.dsfactory.myproject.pool.maxExpiryTime=3600
torque.dsfactory.myproject.pool.connectionWaitTimeout=10

torque.dsfactory.myproject.connection.driver = org.postgresql.Driver
torque.dsfactory.myproject.connection.url = jdbc:postgresql://host:5432/database
torque.dsfactory.myproject.connection.user = username
torque.dsfactory.myproject.connection.password = password




On Thu, 3 Apr 2003, Jenny Brown wrote:

> I'm using Torque stand-alone, and am having trouble getting the
> data source factory configuration set up right.  Here's what I'm
> seeing:
>
> DEBUG Thread-22 org.apache.torque.Torque (Torque.java:318) - handle:
>  defaults DataSourceFactory: org.apache.torque.dsfactory.TorqueDataSourceFactory
> DEBUG Thread-22 org.apache.torque.dsfactory.TorqueDataSourceFactory
>   (TorqueDataSourceFactory.java:124) - Starting initCPDS
>
> ERROR Thread-22 org.apache.torque.dsfactory.TorqueDataSourceFactory
> (TorqueDataSourceFactory.java:139) - java.lang.NullPointerException at
>  org.apache.torque.dsfactory.TorqueDataSourceFactory.initCPDS(TorqueDataSourceFactory.java:129) at
>
>  org.apache.torque.dsfactory.TorqueDataSourceFactory.initialize(TorqueDataSourceFactory.java:108) at
>  org.apache.torque.Torque.initDataSourceFactories(Torque.java:323) at
>  org.apache.torque.Torque.initialize(Torque.java:237) at
>  org.apache.torque.Torque.init(Torque.java:406) at
>  org.apache.torque.Torque.init(Torque.java:386) at
>  HelperServlet.handleRequest(HelperServlet.java:109) at
>  org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:372)
>  ...  [more snipped]
>
>
> I've tried setting all kinds of properties file keys for connections and
> pools and yet thing null pointer keeps appearing.  I tried looking into
> the source xreference on the site for clues but it seems to be out of
> date; the line numbers don't match anything meaningful.
>
> The result of this is that Torque can't get connection to the database,
> which really limits its functionality (it works in most areas if I
> pass my own connection in, but some functions don't allow that).
>
> I'm really stuck on this, can't figure out what I am doing wrong that
> the data source factory won't configure/init properly.
>
> Ant can connect to my database just find with its build.properties.  I'm
> calling Torque.init() with a path to a Torque.properties as well.  I am
> certain the configuration is being read into torque because I can loop
> through the keys and see them in debugging.  But somehow I'm missing
> something that the datasource wants, and I don't know what.
>
> Jenny Brown
>
>
>