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 Ronny Walter <ma...@freenet.de> on 2003/04/14 17:29:09 UTC

NullpointerException

Hello,

I've tested the generation of the XML-Schema. Then i created the Objects
and wrote a little testclass:

public class ScheduleReader {
	public static void main(String[] args) throws Exception {
		Torque.init("Torque.properties");
		Schedule sch = null;
		Criteria crit = new Criteria();
		crit.add(SchedulePeer.HOMETEAM, "Chicago%");
		List l = SchedulePeer.doSelect(crit);
		Iterator it = l.iterator();
		while (it.hasNext()) {
			System.out.println(((Schedule)
it.next()).getTitle());
		}
	}
}

The propertiy file:
torque.database.default.adapter=mysql
torque.dsfactory.default.pool.defaultMaxConnections=10
torque.dsfactory.default.pool.maxExpiryTime=3600
torque.dsfactory.default.pool.connectionWaitTimeout=10
### MySQL
torque.dsfactory.default.connection.driver = org.gjt.mm.mysql.Driver
torque.dsfactory.default.connection.url =
jdbc:mysql://localhost:3306/centerice
torque.dsfactory.default.connection.user = atlan
torque.dsfactory.default.connection.password = 
log4j.category.org.apache.torque = INFO, torque
log4j.appender.torque = org.apache.log4j.FileAppender
log4j.appender.torque.file = ./centerice.log
log4j.appender.torque.layout = org.apache.log4j.PatternLayout
log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.torque.append = false

After starting the Programm, the following error occurs:

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
de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePeer
.java:414)
	at
de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePeer
.java:382)
	at
de.centerice.om.BaseSchedulePeer.doSelect(BaseSchedulePeer.java:350)
	at
de.centerice.tests.ScheduleReader.main(ScheduleReader.java:27)
Exception in thread "main"


The logfile says:
2003-04-14 17:21:42,385 [main] INFO  org.apache.torque.Torque - Logging
has been configured by Torque.
2003-04-14 17:21:42,525 [main] WARN  org.apache.torque.oid.IDBroker -
IDBroker is being used with db 'default', 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.



Whats wrong?
Thank you for some hints :-)

Ronny
 


AW: AW: AW: NullpointerException

Posted by Ronny Walter <ma...@freenet.de>.
Ok ok, i love this message :-) With my database i don't need
transactions, i think. Thank you for your help.

Ronny


-----Ursprüngliche Nachricht-----
Von: Brian K. Wallace [mailto:brian@transmorphix.com] 
Gesendet: Montag, 14. April 2003 20:12
An: Turbine Torque Users List
Betreff: Re: AW: AW: NullpointerException


If you want to get technical.... there is a way to avoid this message -
- go with a DB 
that has basic support for transactions from db through driver into
Torque. ;-) [no, I'm 
not going the "But MySQL does have transaction support" route - just
sayin']. 
Otherwise, take the warning for what it's worth to you, or try to play
logging games 
around the Torque.init (set the level to ERROR, init, then back to
WARN). I've seen 
this warning so much I'd think it was broken if it wasn't there. :-)

Glad to see you're up and running, tho'.


On 14 Apr 2003 at 20:13, Ronny Walter wrote:

> Thank you, now it works. :-) I selected my first objects  with torque.
> 
> Now i get a warning:
> 591 [main] WARN oid.IDBroker  - IDBroker is being used with db 
> 'default', 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.
> 
> I am sure, that there is a possibility to avoid this message :-)
> 
> Ronny
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Brian K. Wallace [mailto:brian@transmorphix.com]
> Gesendet: Montag, 14. April 2003 19:39
> An: Turbine Torque Users List
> Betreff: Re: AW: NullpointerException
> 
> 
> I'm currently using Torque to talk to quite a few databases including 
> MySQL. I responded with the initial problem that I had and how I fixed

> it, but in looking closer at
> your properties, you're also missing the factory property. Below is a
> snippet from my 
> config that encompasses all connection information for a single db -
> where I have 
> 'appdb', yours is listed as 'default':
> 
> torque.database.default=appdb torque.database.appdb.adapter=mysql
> torque.dsfactory.appdb.factory=org.apache.torque.dsfactory.TorqueDataS
> ou
> rceFact
> ory
> torque.dsfactory.appdb.pool.defaultMaxConnections=15
> torque.dsfactory.appdb.pool.maxExpiryTime=1200
> torque.dsfactory.appdb.pool.connectionWaitTimeout=10
> torque.dsfactory.appdb.connection.driver = org.gjt.mm.mysql.Driver
> torque.dsfactory.appdb.connection.url =
> jdbc:mysql://localhost:3306/apdb0001
> torque.dsfactory.appdb.connection.user = username
> torque.dsfactory.appdb.connection.password = password
> 
> torque.idbroker.cleverquantity = true
> torque.manager.useCache = true
> 
> I didn't find much on the internet that addresses this, but I hope 
> this helps.
> 
> On 14 Apr 2003 at 19:34, Ronny Walter wrote:
> 
> > It's still doesn't work :-(
> > 
> > Is there an example with a mysql-database in the internet?
> > 
> > 
> > Ronny
> > 
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: Brian K. Wallace [mailto:brian@transmorphix.com]
> > Gesendet: Montag, 14. April 2003 17:43
> > An: Turbine Torque Users List
> > Betreff: Re: NullpointerException
> > 
> > 
> > Try adding the line
> > 
> >   torque.database.default=default
> > 
> > to your property file.
> > 
> > 
> > On 14 Apr 2003 at 17:29, Ronny Walter wrote:
> > 
> > > Hello,
> > > 
> > > I've tested the generation of the XML-Schema. Then i created the 
> > > Objects and wrote a little testclass:
> > > 
> > > public class ScheduleReader {
> > > 	public static void main(String[] args) throws Exception {
> > > 		Torque.init("Torque.properties");
> > > 		Schedule sch = null;
> > > 		Criteria crit = new Criteria();
> > > 		crit.add(SchedulePeer.HOMETEAM, "Chicago%");
> > > 		List l = SchedulePeer.doSelect(crit);
> > > 		Iterator it = l.iterator();
> > > 		while (it.hasNext()) {
> > > 			System.out.println(((Schedule)
> > > it.next()).getTitle());
> > > 		}
> > > 	}
> > > }
> > > 
> > > The propertiy file:
> > > torque.database.default.adapter=mysql
> > > torque.dsfactory.default.pool.defaultMaxConnections=10
> > > torque.dsfactory.default.pool.maxExpiryTime=3600
> > > torque.dsfactory.default.pool.connectionWaitTimeout=10
> > > ### MySQL
> > > torque.dsfactory.default.connection.driver = 
> > > org.gjt.mm.mysql.Driver torque.dsfactory.default.connection.url = 
> > > jdbc:mysql://localhost:3306/centerice
> > > torque.dsfactory.default.connection.user = atlan
> > > torque.dsfactory.default.connection.password = 
> > > log4j.category.org.apache.torque = INFO, torque
> log4j.appender.torque
> > > = org.apache.log4j.FileAppender log4j.appender.torque.file =
> > > ./centerice.log log4j.appender.torque.layout = 
> > > org.apache.log4j.PatternLayout 
> > > log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c -

> > > %m%n log4j.appender.torque.append = false
> > > 
> > > After starting the Programm, the following error occurs:
> > > 
> > > 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 
> > >
> de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePe
> > > er
> > > .java:414)
> > > 	at
> > >
> > de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedule
> > Pe
> > er
> > > .java:382)
> > > 	at
> > >
de.centerice.om.BaseSchedulePeer.doSelect(BaseSchedulePeer.java:350)
> > > 	at
> > > de.centerice.tests.ScheduleReader.main(ScheduleReader.java:27)
> > > Exception in thread "main"
> > > 
> > > 
> > > The logfile says:
> > > 2003-04-14 17:21:42,385 [main] INFO  org.apache.torque.Torque - 
> > > Logging has been configured by Torque. 2003-04-14 17:21:42,525
> [main]
> > > WARN  org.apache.torque.oid.IDBroker - IDBroker is being used with
> db
> > > 'default', 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.
> > > 
> > > 
> > > 
> > > Whats wrong?
> > > Thank you for some hints :-)
> > > 
> > > Ronny
> > >  
> > > 
> > > 
> > > ------------------------------------------------------------------
> > > --
> > > -
> > > 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
> > 
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> 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



Re: AW: AW: NullpointerException

Posted by "Brian K. Wallace" <br...@transmorphix.com>.
If you want to get technical.... there is a way to avoid this message - - go with a DB 
that has basic support for transactions from db through driver into Torque. ;-) [no, I'm 
not going the "But MySQL does have transaction support" route - just sayin']. 
Otherwise, take the warning for what it's worth to you, or try to play logging games 
around the Torque.init (set the level to ERROR, init, then back to WARN). I've seen 
this warning so much I'd think it was broken if it wasn't there. :-)

Glad to see you're up and running, tho'.


On 14 Apr 2003 at 20:13, Ronny Walter wrote:

> Thank you, now it works. :-) I selected my first objects  with torque.
> 
> Now i get a warning:
> 591 [main] WARN oid.IDBroker  - IDBroker is being used with db
> 'default', 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.
> 
> I am sure, that there is a possibility to avoid this message :-)
> 
> Ronny
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Brian K. Wallace [mailto:brian@transmorphix.com] 
> Gesendet: Montag, 14. April 2003 19:39
> An: Turbine Torque Users List
> Betreff: Re: AW: NullpointerException
> 
> 
> I'm currently using Torque to talk to quite a few databases including
> MySQL. I 
> responded with the initial problem that I had and how I fixed it, but in
> looking closer at 
> your properties, you're also missing the factory property. Below is a
> snippet from my 
> config that encompasses all connection information for a single db -
> where I have 
> 'appdb', yours is listed as 'default':
> 
> torque.database.default=appdb torque.database.appdb.adapter=mysql
> torque.dsfactory.appdb.factory=org.apache.torque.dsfactory.TorqueDataSou
> rceFact
> ory
> torque.dsfactory.appdb.pool.defaultMaxConnections=15
> torque.dsfactory.appdb.pool.maxExpiryTime=1200
> torque.dsfactory.appdb.pool.connectionWaitTimeout=10
> torque.dsfactory.appdb.connection.driver = org.gjt.mm.mysql.Driver
> torque.dsfactory.appdb.connection.url =
> jdbc:mysql://localhost:3306/apdb0001
> torque.dsfactory.appdb.connection.user = username
> torque.dsfactory.appdb.connection.password = password
> 
> torque.idbroker.cleverquantity = true
> torque.manager.useCache = true
> 
> I didn't find much on the internet that addresses this, but I hope this
> helps.
> 
> On 14 Apr 2003 at 19:34, Ronny Walter wrote:
> 
> > It's still doesn't work :-(
> > 
> > Is there an example with a mysql-database in the internet?
> > 
> > 
> > Ronny
> > 
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: Brian K. Wallace [mailto:brian@transmorphix.com]
> > Gesendet: Montag, 14. April 2003 17:43
> > An: Turbine Torque Users List
> > Betreff: Re: NullpointerException
> > 
> > 
> > Try adding the line
> > 
> >   torque.database.default=default
> > 
> > to your property file.
> > 
> > 
> > On 14 Apr 2003 at 17:29, Ronny Walter wrote:
> > 
> > > Hello,
> > > 
> > > I've tested the generation of the XML-Schema. Then i created the
> > > Objects and wrote a little testclass:
> > > 
> > > public class ScheduleReader {
> > > 	public static void main(String[] args) throws Exception {
> > > 		Torque.init("Torque.properties");
> > > 		Schedule sch = null;
> > > 		Criteria crit = new Criteria();
> > > 		crit.add(SchedulePeer.HOMETEAM, "Chicago%");
> > > 		List l = SchedulePeer.doSelect(crit);
> > > 		Iterator it = l.iterator();
> > > 		while (it.hasNext()) {
> > > 			System.out.println(((Schedule)
> > > it.next()).getTitle());
> > > 		}
> > > 	}
> > > }
> > > 
> > > The propertiy file:
> > > torque.database.default.adapter=mysql
> > > torque.dsfactory.default.pool.defaultMaxConnections=10
> > > torque.dsfactory.default.pool.maxExpiryTime=3600
> > > torque.dsfactory.default.pool.connectionWaitTimeout=10
> > > ### MySQL
> > > torque.dsfactory.default.connection.driver = org.gjt.mm.mysql.Driver
> > > torque.dsfactory.default.connection.url = 
> > > jdbc:mysql://localhost:3306/centerice
> > > torque.dsfactory.default.connection.user = atlan 
> > > torque.dsfactory.default.connection.password = 
> > > log4j.category.org.apache.torque = INFO, torque
> log4j.appender.torque 
> > > = org.apache.log4j.FileAppender log4j.appender.torque.file = 
> > > ./centerice.log log4j.appender.torque.layout = 
> > > org.apache.log4j.PatternLayout 
> > > log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c - 
> > > %m%n log4j.appender.torque.append = false
> > > 
> > > After starting the Programm, the following error occurs:
> > > 
> > > 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 
> > >
> de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePe
> > > er
> > > .java:414)
> > > 	at
> > >
> > de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePe
> > er
> > > .java:382)
> > > 	at
> > > de.centerice.om.BaseSchedulePeer.doSelect(BaseSchedulePeer.java:350)
> > > 	at
> > > de.centerice.tests.ScheduleReader.main(ScheduleReader.java:27)
> > > Exception in thread "main"
> > > 
> > > 
> > > The logfile says:
> > > 2003-04-14 17:21:42,385 [main] INFO  org.apache.torque.Torque -
> > > Logging has been configured by Torque. 2003-04-14 17:21:42,525
> [main] 
> > > WARN  org.apache.torque.oid.IDBroker - IDBroker is being used with
> db 
> > > 'default', 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.
> > > 
> > > 
> > > 
> > > Whats wrong?
> > > Thank you for some hints :-)
> > > 
> > > Ronny
> > >  
> > > 
> > > 
> > > --------------------------------------------------------------------
> > > -
> > > 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
> > 
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 



AW: AW: NullpointerException

Posted by Ronny Walter <ma...@freenet.de>.
Thank you, now it works. :-) I selected my first objects  with torque.

Now i get a warning:
591 [main] WARN oid.IDBroker  - IDBroker is being used with db
'default', 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.

I am sure, that there is a possibility to avoid this message :-)

Ronny


-----Ursprüngliche Nachricht-----
Von: Brian K. Wallace [mailto:brian@transmorphix.com] 
Gesendet: Montag, 14. April 2003 19:39
An: Turbine Torque Users List
Betreff: Re: AW: NullpointerException


I'm currently using Torque to talk to quite a few databases including
MySQL. I 
responded with the initial problem that I had and how I fixed it, but in
looking closer at 
your properties, you're also missing the factory property. Below is a
snippet from my 
config that encompasses all connection information for a single db -
where I have 
'appdb', yours is listed as 'default':

torque.database.default=appdb torque.database.appdb.adapter=mysql
torque.dsfactory.appdb.factory=org.apache.torque.dsfactory.TorqueDataSou
rceFact
ory
torque.dsfactory.appdb.pool.defaultMaxConnections=15
torque.dsfactory.appdb.pool.maxExpiryTime=1200
torque.dsfactory.appdb.pool.connectionWaitTimeout=10
torque.dsfactory.appdb.connection.driver = org.gjt.mm.mysql.Driver
torque.dsfactory.appdb.connection.url =
jdbc:mysql://localhost:3306/apdb0001
torque.dsfactory.appdb.connection.user = username
torque.dsfactory.appdb.connection.password = password

torque.idbroker.cleverquantity = true
torque.manager.useCache = true

I didn't find much on the internet that addresses this, but I hope this
helps.

On 14 Apr 2003 at 19:34, Ronny Walter wrote:

> It's still doesn't work :-(
> 
> Is there an example with a mysql-database in the internet?
> 
> 
> Ronny
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Brian K. Wallace [mailto:brian@transmorphix.com]
> Gesendet: Montag, 14. April 2003 17:43
> An: Turbine Torque Users List
> Betreff: Re: NullpointerException
> 
> 
> Try adding the line
> 
>   torque.database.default=default
> 
> to your property file.
> 
> 
> On 14 Apr 2003 at 17:29, Ronny Walter wrote:
> 
> > Hello,
> > 
> > I've tested the generation of the XML-Schema. Then i created the
> > Objects and wrote a little testclass:
> > 
> > public class ScheduleReader {
> > 	public static void main(String[] args) throws Exception {
> > 		Torque.init("Torque.properties");
> > 		Schedule sch = null;
> > 		Criteria crit = new Criteria();
> > 		crit.add(SchedulePeer.HOMETEAM, "Chicago%");
> > 		List l = SchedulePeer.doSelect(crit);
> > 		Iterator it = l.iterator();
> > 		while (it.hasNext()) {
> > 			System.out.println(((Schedule)
> > it.next()).getTitle());
> > 		}
> > 	}
> > }
> > 
> > The propertiy file:
> > torque.database.default.adapter=mysql
> > torque.dsfactory.default.pool.defaultMaxConnections=10
> > torque.dsfactory.default.pool.maxExpiryTime=3600
> > torque.dsfactory.default.pool.connectionWaitTimeout=10
> > ### MySQL
> > torque.dsfactory.default.connection.driver = org.gjt.mm.mysql.Driver
> > torque.dsfactory.default.connection.url = 
> > jdbc:mysql://localhost:3306/centerice
> > torque.dsfactory.default.connection.user = atlan 
> > torque.dsfactory.default.connection.password = 
> > log4j.category.org.apache.torque = INFO, torque
log4j.appender.torque 
> > = org.apache.log4j.FileAppender log4j.appender.torque.file = 
> > ./centerice.log log4j.appender.torque.layout = 
> > org.apache.log4j.PatternLayout 
> > log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c - 
> > %m%n log4j.appender.torque.append = false
> > 
> > After starting the Programm, the following error occurs:
> > 
> > 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 
> >
de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePe
> > er
> > .java:414)
> > 	at
> >
> de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePe
> er
> > .java:382)
> > 	at
> > de.centerice.om.BaseSchedulePeer.doSelect(BaseSchedulePeer.java:350)
> > 	at
> > de.centerice.tests.ScheduleReader.main(ScheduleReader.java:27)
> > Exception in thread "main"
> > 
> > 
> > The logfile says:
> > 2003-04-14 17:21:42,385 [main] INFO  org.apache.torque.Torque -
> > Logging has been configured by Torque. 2003-04-14 17:21:42,525
[main] 
> > WARN  org.apache.torque.oid.IDBroker - IDBroker is being used with
db 
> > 'default', 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.
> > 
> > 
> > 
> > Whats wrong?
> > Thank you for some hints :-)
> > 
> > Ronny
> >  
> > 
> > 
> > --------------------------------------------------------------------
> > -
> > 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
> 
> 



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



Re: AW: NullpointerException

Posted by "Brian K. Wallace" <br...@transmorphix.com>.
I'm currently using Torque to talk to quite a few databases including MySQL. I 
responded with the initial problem that I had and how I fixed it, but in looking closer at 
your properties, you're also missing the factory property. Below is a snippet from my 
config that encompasses all connection information for a single db - where I have 
'appdb', yours is listed as 'default':

torque.database.default=appdb
torque.database.appdb.adapter=mysql
torque.dsfactory.appdb.factory=org.apache.torque.dsfactory.TorqueDataSourceFact
ory
torque.dsfactory.appdb.pool.defaultMaxConnections=15
torque.dsfactory.appdb.pool.maxExpiryTime=1200
torque.dsfactory.appdb.pool.connectionWaitTimeout=10
torque.dsfactory.appdb.connection.driver = org.gjt.mm.mysql.Driver
torque.dsfactory.appdb.connection.url = jdbc:mysql://localhost:3306/apdb0001
torque.dsfactory.appdb.connection.user = username
torque.dsfactory.appdb.connection.password = password

torque.idbroker.cleverquantity = true
torque.manager.useCache = true

I didn't find much on the internet that addresses this, but I hope this helps.

On 14 Apr 2003 at 19:34, Ronny Walter wrote:

> It's still doesn't work :-(
> 
> Is there an example with a mysql-database in the internet?
> 
> 
> Ronny
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Brian K. Wallace [mailto:brian@transmorphix.com] 
> Gesendet: Montag, 14. April 2003 17:43
> An: Turbine Torque Users List
> Betreff: Re: NullpointerException
> 
> 
> Try adding the line
> 
>   torque.database.default=default
> 
> to your property file.
> 
> 
> On 14 Apr 2003 at 17:29, Ronny Walter wrote:
> 
> > Hello,
> > 
> > I've tested the generation of the XML-Schema. Then i created the 
> > Objects and wrote a little testclass:
> > 
> > public class ScheduleReader {
> > 	public static void main(String[] args) throws Exception {
> > 		Torque.init("Torque.properties");
> > 		Schedule sch = null;
> > 		Criteria crit = new Criteria();
> > 		crit.add(SchedulePeer.HOMETEAM, "Chicago%");
> > 		List l = SchedulePeer.doSelect(crit);
> > 		Iterator it = l.iterator();
> > 		while (it.hasNext()) {
> > 			System.out.println(((Schedule)
> > it.next()).getTitle());
> > 		}
> > 	}
> > }
> > 
> > The propertiy file:
> > torque.database.default.adapter=mysql
> > torque.dsfactory.default.pool.defaultMaxConnections=10
> > torque.dsfactory.default.pool.maxExpiryTime=3600
> > torque.dsfactory.default.pool.connectionWaitTimeout=10
> > ### MySQL
> > torque.dsfactory.default.connection.driver = org.gjt.mm.mysql.Driver 
> > torque.dsfactory.default.connection.url = 
> > jdbc:mysql://localhost:3306/centerice
> > torque.dsfactory.default.connection.user = atlan 
> > torque.dsfactory.default.connection.password = 
> > log4j.category.org.apache.torque = INFO, torque log4j.appender.torque 
> > = org.apache.log4j.FileAppender log4j.appender.torque.file = 
> > ./centerice.log log4j.appender.torque.layout = 
> > org.apache.log4j.PatternLayout 
> > log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c - 
> > %m%n log4j.appender.torque.append = false
> > 
> > After starting the Programm, the following error occurs:
> > 
> > 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 
> > de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePe
> > er
> > .java:414)
> > 	at
> >
> de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePeer
> > .java:382)
> > 	at
> > de.centerice.om.BaseSchedulePeer.doSelect(BaseSchedulePeer.java:350)
> > 	at
> > de.centerice.tests.ScheduleReader.main(ScheduleReader.java:27)
> > Exception in thread "main"
> > 
> > 
> > The logfile says:
> > 2003-04-14 17:21:42,385 [main] INFO  org.apache.torque.Torque - 
> > Logging has been configured by Torque. 2003-04-14 17:21:42,525 [main] 
> > WARN  org.apache.torque.oid.IDBroker - IDBroker is being used with db 
> > 'default', 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.
> > 
> > 
> > 
> > Whats wrong?
> > Thank you for some hints :-)
> > 
> > Ronny
> >  
> > 
> > 
> > ---------------------------------------------------------------------
> > 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
> 
> 



AW: NullpointerException

Posted by Ronny Walter <ma...@freenet.de>.
It's still doesn't work :-(

Is there an example with a mysql-database in the internet?


Ronny


-----Ursprüngliche Nachricht-----
Von: Brian K. Wallace [mailto:brian@transmorphix.com] 
Gesendet: Montag, 14. April 2003 17:43
An: Turbine Torque Users List
Betreff: Re: NullpointerException


Try adding the line

  torque.database.default=default

to your property file.


On 14 Apr 2003 at 17:29, Ronny Walter wrote:

> Hello,
> 
> I've tested the generation of the XML-Schema. Then i created the 
> Objects and wrote a little testclass:
> 
> public class ScheduleReader {
> 	public static void main(String[] args) throws Exception {
> 		Torque.init("Torque.properties");
> 		Schedule sch = null;
> 		Criteria crit = new Criteria();
> 		crit.add(SchedulePeer.HOMETEAM, "Chicago%");
> 		List l = SchedulePeer.doSelect(crit);
> 		Iterator it = l.iterator();
> 		while (it.hasNext()) {
> 			System.out.println(((Schedule)
> it.next()).getTitle());
> 		}
> 	}
> }
> 
> The propertiy file:
> torque.database.default.adapter=mysql
> torque.dsfactory.default.pool.defaultMaxConnections=10
> torque.dsfactory.default.pool.maxExpiryTime=3600
> torque.dsfactory.default.pool.connectionWaitTimeout=10
> ### MySQL
> torque.dsfactory.default.connection.driver = org.gjt.mm.mysql.Driver 
> torque.dsfactory.default.connection.url = 
> jdbc:mysql://localhost:3306/centerice
> torque.dsfactory.default.connection.user = atlan 
> torque.dsfactory.default.connection.password = 
> log4j.category.org.apache.torque = INFO, torque log4j.appender.torque 
> = org.apache.log4j.FileAppender log4j.appender.torque.file = 
> ./centerice.log log4j.appender.torque.layout = 
> org.apache.log4j.PatternLayout 
> log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c - 
> %m%n log4j.appender.torque.append = false
> 
> After starting the Programm, the following error occurs:
> 
> 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 
> de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePe
> er
> .java:414)
> 	at
>
de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePeer
> .java:382)
> 	at
> de.centerice.om.BaseSchedulePeer.doSelect(BaseSchedulePeer.java:350)
> 	at
> de.centerice.tests.ScheduleReader.main(ScheduleReader.java:27)
> Exception in thread "main"
> 
> 
> The logfile says:
> 2003-04-14 17:21:42,385 [main] INFO  org.apache.torque.Torque - 
> Logging has been configured by Torque. 2003-04-14 17:21:42,525 [main] 
> WARN  org.apache.torque.oid.IDBroker - IDBroker is being used with db 
> 'default', 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.
> 
> 
> 
> Whats wrong?
> Thank you for some hints :-)
> 
> Ronny
>  
> 
> 
> ---------------------------------------------------------------------
> 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



Re: NullpointerException

Posted by "Brian K. Wallace" <br...@transmorphix.com>.
Try adding the line

  torque.database.default=default

to your property file.


On 14 Apr 2003 at 17:29, Ronny Walter wrote:

> Hello,
> 
> I've tested the generation of the XML-Schema. Then i created the Objects
> and wrote a little testclass:
> 
> public class ScheduleReader {
> 	public static void main(String[] args) throws Exception {
> 		Torque.init("Torque.properties");
> 		Schedule sch = null;
> 		Criteria crit = new Criteria();
> 		crit.add(SchedulePeer.HOMETEAM, "Chicago%");
> 		List l = SchedulePeer.doSelect(crit);
> 		Iterator it = l.iterator();
> 		while (it.hasNext()) {
> 			System.out.println(((Schedule)
> it.next()).getTitle());
> 		}
> 	}
> }
> 
> The propertiy file:
> torque.database.default.adapter=mysql
> torque.dsfactory.default.pool.defaultMaxConnections=10
> torque.dsfactory.default.pool.maxExpiryTime=3600
> torque.dsfactory.default.pool.connectionWaitTimeout=10
> ### MySQL
> torque.dsfactory.default.connection.driver = org.gjt.mm.mysql.Driver
> torque.dsfactory.default.connection.url =
> jdbc:mysql://localhost:3306/centerice
> torque.dsfactory.default.connection.user = atlan
> torque.dsfactory.default.connection.password = 
> log4j.category.org.apache.torque = INFO, torque
> log4j.appender.torque = org.apache.log4j.FileAppender
> log4j.appender.torque.file = ./centerice.log
> log4j.appender.torque.layout = org.apache.log4j.PatternLayout
> log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c - %m%n
> log4j.appender.torque.append = false
> 
> After starting the Programm, the following error occurs:
> 
> 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
> de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePeer
> .java:414)
> 	at
> de.centerice.om.BaseSchedulePeer.doSelectVillageRecords(BaseSchedulePeer
> .java:382)
> 	at
> de.centerice.om.BaseSchedulePeer.doSelect(BaseSchedulePeer.java:350)
> 	at
> de.centerice.tests.ScheduleReader.main(ScheduleReader.java:27)
> Exception in thread "main"
> 
> 
> The logfile says:
> 2003-04-14 17:21:42,385 [main] INFO  org.apache.torque.Torque - Logging
> has been configured by Torque.
> 2003-04-14 17:21:42,525 [main] WARN  org.apache.torque.oid.IDBroker -
> IDBroker is being used with db 'default', 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.
> 
> 
> 
> Whats wrong?
> Thank you for some hints :-)
> 
> Ronny
>  
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
>