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 Derick Fernando <de...@xenocex.com> on 2003/01/24 03:32:01 UTC

Null Connection Object

Hello,

I keep getting:

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.
at org.apache.torque.util.Transaction.rollback(Transaction.java:179)
at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1333)
at
com.aurajen46.web.om.BaseProductsPeer.doSelectVillageRecords(BaseProductsPee
r.java:515)
at
com.aurajen46.web.om.BaseProductsPeer.doSelectVillageRecords(BaseProductsPee
r.java:435)
at com.aurajen46.web.om.BaseProductsPeer.doSelect(BaseProductsPeer.java:403)
at com.aurajen46.web.modules.screens.Man.getDefaultShirt(Man.java:111)
at com.aurajen46.web.modules.screens.Man.getcurrentItem(Man.java:165)
at com.aurajen46.web.modules.screens.Man.doBuildTemplate(Man.java:63)
at
org.apache.turbine.modules.screens.VelocityScreen.doBuildTemplate(VelocitySc
reen.java:111)
at
org.apache.turbine.modules.screens.TemplateScreen.doBuild(TemplateScreen.jav
a:129)
at org.apache.turbine.modules.Screen.build(Screen.java:99)
at org.apache.turbine.modules.ScreenLoader.eval(ScreenLoader.java:129)
#######################

But the same webapp, with the same databse name and same username etc works
perfectly on two development stations. When I upload it to the host however,
I keep getting this error. I've checked Torque.properties over and over, and
can't find anything wrong with it:

torque.database.default=web
torque.database.web.adapter=mysql
## Using torque's old pool
torque.dsfactory.web.factory=org.apache.torque.dsfactory.TorqueDataSourceFac
tory
torque.dsfactory.web.pool.defaultMaxConnections=10
torque.dsfactory.web.pool.maxExpiryTime=3600
torque.dsfactory.web.pool.connectionWaitTimeout=10
torque.dsfactory.web.connection.driver = org.gjt.mm.mysql.Driver
torque.dsfactory.web.connection.url = jdbc:mysql://localhost/aura
torque.dsfactory.web.connection.user = aurauser
torque.dsfactory.web.connection.password = password


Any Ideas?
Thanks,
Derick


Re: Null Connection Object

Posted by Derick Fernando <de...@xenocex.com>.
Hello,

Thanks, But taht doesn't seem to be it.

Derick

----- Original Message ----- 
From: "Patryk Laurent" <pa...@snt-inc.com>
To: "Turbine Torque Users List" <tu...@jakarta.apache.org>
Sent: Friday, January 24, 2003 5:59 AM
Subject: Re: Null Connection Object



Re: Null Connection Object

Posted by Patryk Laurent <pa...@snt-inc.com>.
Derick,

Maybe this is too obvious, but I always get that error

1 - if I forget to start up mysql/psql on the new box, or 

2 - if I forget to allow TCP/IP connections on that instance of the
server (such as postmaster -i with PostgreSQL).  However I think mysql
allows connections by defauly so this may not apply.


Patryk
 

On Thu, 2003-01-23 at 21:32, Derick Fernando wrote:
> Hello,
> 
> I keep getting:
> 
> 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.
> at org.apache.torque.util.Transaction.rollback(Transaction.java:179)
> at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1333)
> at
> com.aurajen46.web.om.BaseProductsPeer.doSelectVillageRecords(BaseProductsPee
> r.java:515)
> at
> com.aurajen46.web.om.BaseProductsPeer.doSelectVillageRecords(BaseProductsPee
> r.java:435)
> at com.aurajen46.web.om.BaseProductsPeer.doSelect(BaseProductsPeer.java:403)
> at com.aurajen46.web.modules.screens.Man.getDefaultShirt(Man.java:111)
> at com.aurajen46.web.modules.screens.Man.getcurrentItem(Man.java:165)
> at com.aurajen46.web.modules.screens.Man.doBuildTemplate(Man.java:63)
> at
> org.apache.turbine.modules.screens.VelocityScreen.doBuildTemplate(VelocitySc
> reen.java:111)
> at
> org.apache.turbine.modules.screens.TemplateScreen.doBuild(TemplateScreen.jav
> a:129)
> at org.apache.turbine.modules.Screen.build(Screen.java:99)
> at org.apache.turbine.modules.ScreenLoader.eval(ScreenLoader.java:129)
> #######################
> 
> But the same webapp, with the same databse name and same username etc works
> perfectly on two development stations. When I upload it to the host however,
> I keep getting this error. I've checked Torque.properties over and over, and
> can't find anything wrong with it:
> 
> torque.database.default=web
> torque.database.web.adapter=mysql
> ## Using torque's old pool
> torque.dsfactory.web.factory=org.apache.torque.dsfactory.TorqueDataSourceFac
> tory
> torque.dsfactory.web.pool.defaultMaxConnections=10
> torque.dsfactory.web.pool.maxExpiryTime=3600
> torque.dsfactory.web.pool.connectionWaitTimeout=10
> torque.dsfactory.web.connection.driver = org.gjt.mm.mysql.Driver
> torque.dsfactory.web.connection.url = jdbc:mysql://localhost/aura
> torque.dsfactory.web.connection.user = aurauser
> torque.dsfactory.web.connection.password = password
> 
> 
> Any Ideas?
> Thanks,
> Derick
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


Re: Null Connection Object

Posted by Derick Fernando <de...@xenocex.com>.
Hello,

Turns out it was a RedHat issue, that explains why none of the other
machines had problems with it.

In /etc/hosts RedHat apparently shipped with:

127.0.0.1 localhost.localdomain localhost
should be:
127.0.0.1 localhost localhost.localdomain

This problem was outlined in the MySQL Connector/J Readme
Excerpt:
++++++++++++++++++++++++++++++++++++++++++++

"When I try to connect to the database with MySQL Connector/J , I get the
following exception:
SQLException: Server configuration denies access to data source
SQLState: 08001
VendorError: 0
What's going on? I can connect with the MySQL client."
Resolution:
MySQL Connector/J must use TCP/IP sockets to connect to MySQL, as
Java does not support Unix Domain Sockets. Therefore, when MySQL Connector/J
connects to MySQL, the security manager in MySQL server will use the
HOSTS table to determine whether or not the connection should be allowed.
You must add grants to allow this to happen. The following is an example
of how to do this (but not the most secure).

Re: Null Connection Object

Posted by Prescott Balch <pr...@prescottbalch.org>.
I had the same problem and finally determined, with help from this fine  
list, that I needed to specify the name of the database in my  
schema.xml, e.g.:

<database name="mydatabasename">

where "mydatabasename" equals the value of torque.database.default in  
the Torque.properties file.

I had simply coded:

<database>

On Thursday, January 23, 2003, at 08:32 PM, Derick Fernando wrote:

> Hello,
>
> I keep getting:
>
> 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.
> at org.apache.torque.util.Transaction.rollback(Transaction.java:179)
> at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1333)
> at
> com.aurajen46.web.om.BaseProductsPeer.doSelectVillageRecords(BaseProduc 
> tsPee
> r.java:515)
> at
> com.aurajen46.web.om.BaseProductsPeer.doSelectVillageRecords(BaseProduc 
> tsPee
> r.java:435)
> at  
> com.aurajen46.web.om.BaseProductsPeer.doSelect(BaseProductsPeer.java:40 
> 3)
> at com.aurajen46.web.modules.screens.Man.getDefaultShirt(Man.java:111)
> at com.aurajen46.web.modules.screens.Man.getcurrentItem(Man.java:165)
> at com.aurajen46.web.modules.screens.Man.doBuildTemplate(Man.java:63)
> at
> org.apache.turbine.modules.screens.VelocityScreen.doBuildTemplate(Veloc 
> itySc
> reen.java:111)
> at
> org.apache.turbine.modules.screens.TemplateScreen.doBuild(TemplateScree 
> n.jav
> a:129)
> at org.apache.turbine.modules.Screen.build(Screen.java:99)
> at org.apache.turbine.modules.ScreenLoader.eval(ScreenLoader.java:129)
> #######################
>
> But the same webapp, with the same databse name and same username etc  
> works
> perfectly on two development stations. When I upload it to the host  
> however,
> I keep getting this error. I've checked Torque.properties over and  
> over, and
> can't find anything wrong with it:
>
> torque.database.default=web
> torque.database.web.adapter=mysql
> ## Using torque's old pool
> torque.dsfactory.web.factory=org.apache.torque.dsfactory.TorqueDataSour 
> ceFac
> tory
> torque.dsfactory.web.pool.defaultMaxConnections=10
> torque.dsfactory.web.pool.maxExpiryTime=3600
> torque.dsfactory.web.pool.connectionWaitTimeout=10
> torque.dsfactory.web.connection.driver = org.gjt.mm.mysql.Driver
> torque.dsfactory.web.connection.url = jdbc:mysql://localhost/aura
> torque.dsfactory.web.connection.user = aurauser
> torque.dsfactory.web.connection.password = password
>
>
> Any Ideas?
> Thanks,
> Derick
>
>
> --
> To unsubscribe, e-mail:    
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:  
> <ma...@jakarta.apache.org>
>
>