Hi Tony,

I think you might have a misconfiguration on your hands. The *.dsfactory.* entries are ok as far as I can tell, but the following entries have to be like this:

---------------------------------------------------
torque.database.default=tonys_raleigh
torque.database.default.adapter=mysql
---------------------------------------------------

I've experienced your problem before (java.lang.NullPointerException), and what is happening is that because Torque tries to determine your database by looking up the entry 'torque.database.default.adapter', finding nothing (as it was configured as 'torque.database.tonys_raleigh.adapter'), it will default to the DBNone adaptor as opposed to DBMM (MySQL).

I must admit I am a little curious as to how it managed to work properly at all....

Anyway, hope this helps.

cheers,
CP


Tony Spencer wrote:
I've searched the archives so forgive me if this has already been discussed.

I am running Torque with Resin.  Everything runs beautifully but I have a
weird case in which the retrieved connection from the pool is sometimes
null.  It always occurs when the app has been idle for some time (20 minutes
or so) and it never occurs twice in a row.

For instance, if the app has been idle for 20 minutes (with no requests from
the db) and I click on a link that does a select I get the exception:

java.lang.NullPointerException: Connection object was null. This could be
due to a misconfiguration of the DataSourceFactory. Check the logs and
Torque.properties to better determine the cause.

Clicking the link just once more or hitting refresh does not result in any
exception and everything functions properly.  You can do all kinds of
database activity after the one exception and never get the exception again.

The null connection object after an idle period is always consistent.  I can
hack the code to try to get the connection a couple of times but I was
hoping someone was familiar with this problem or perhaps it is bug.

Also, I am not clear as to whether I should use the TorqueDataSourceFactory
or Jdbc2PoolDataSourceFactory.  I've tried both and experience the same
problem with both.

Here are my current pooling properties:

torque.database.tonys_raleigh.adapter=mysql

torque.dsfactory.tonys_raleigh.factory=org.apache.torque.dsfactory.TorqueDat
aSourceFactory
torque.dsfactory.tonys_raleigh.pool.defaultMaxConnections=10
torque.dsfactory.tonys_raleigh.pool.maxExpiryTime=3600
torque.dsfactory.tonys_raleigh.pool.connectionWaitTimeout=10
torque.dsfactory.tonys_raleigh.connection.driver = org.gjt.mm.mysql.Driver
torque.dsfactory.tonys_raleigh.connection.url =
jdbc:mysql://localhost/tonys_raleigh
torque.dsfactory.tonys_raleigh.connection.user = tonys_tspencer
torque.dsfactory.tonys_raleigh.connection.password = mypass

And here is what I'm using:
Torque 3.0 rc1
Resin 2.1.1
MySql 3.23.53a
JDBC: MySql Connector/J2 (2.0.14)


Much thanks in advance,
Tony


--
To unsubscribe, e-mail:   <mailto:turbine-torque-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:turbine-torque-user-help@;jakarta.apache.org>




--
R E D S H E R I F F
C.P. Lim - Software Engineer
Level 1, 10 Queens Road +61 3 9864 0733 tel
Melbourne VIC +61 3 9864 0778 fax
Australia +61 413 781 846 mob

This message and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, you are hereby notified that any use or dissemination of this communication is strictly prohibited. If you have received this message in error please notify us immediately by return email or telephone +61 (3) 9659 0432, then delete this message. Any views expressed in this message are those of the individual sender and many not necessarily reflect the views of Red Sheriff.


--
To unsubscribe, e-mail: <mailto:turbine-torque-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:turbine-torque-user-help@;jakarta.apache.org>

Reply via email to