db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian K. Wallace" <br...@transmorphix.com>
Subject Re: NullpointerException
Date Mon, 14 Apr 2003 15:42:58 GMT
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
> 
> 



Mime
View raw message