|
RE: NullPointerException while running testcases: msg#00113jakarta.turbine.torque.user
Hi Arne, I further dived into Torque source. If the classloader loads the BaseOrdersPeer before Torque is initialized, the map builder is registered through the static initializer of the BaseOrdersPeer class, and then initialized at Torque.init(): BasePeer.getMapBuilder() called from TorqueInstance.initialize() called from Torque.init() If you initialize torque first and then load the BaseOrdersPeer, the Map is directly built from BaseOrdersPeer's static initializer. I cannot see how anything can go wrong there. If you can easily use a debugger, it may help to set a breakpoint in BaseOrdersPeer.doInsert() and OrdersMapBuilder.doBuild() to see which is called first. Thomas a.winter@xxxxxxxxxxxxx schrieb am 19.11.2004 11:23:22: > Hi Thomas, > > a few days ago I tried myself to find out how these database maps are > initialised, but can't find > a call to one of the DatabaseMap::addTable methodes except in > DatabaseMap::setIdTable > (but I think this isn't relevant). > > I initialize torque in a static block of my junit test class, so Torque > should be initialized only once. > In the meantime I installed torque 3.1.1, but that didn't help. > > Arndt > > > > > > Thomas Fischer <Fischer@xxxxxxxxxxxxx> > 19.11.2004 09:52 > Please respond to "Apache Torque Users List" > > > To: "Apache Torque Users List" <torque-user@xxxxxxxxxxxxx> > cc: > Subject: RE: NullPointerException while running testcases > > > > > > > > Hi Arne, > > I looked a bit through the Torque Source code, and I am a bit at a loss to > see how database maps are initialized. So I can only give you general > advice. > Are you sure you have initialized Torque before the testcase, and if yes, > did you initialize it only once ? > > Thomas > > > a.winter@xxxxxxxxxxxxx schrieb am 19.11.2004 08:29:17: > > > Hello Torque-Users, > > > > while executing the junit testcases for my webapp I get the following > > exception trying to > > save a new record to the database (I'm using torque 3.1 with an oracle > > database): > > > > | +------------------ > > | | Nested Exception: java.lang.NullPointerException > > | | Message: null > > | | Stack trace: > > java.lang.NullPointerException > > at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:697) > > at > > dtag.dns.torque.BaseOrdersPeer.doInsert(BaseOrdersPeer.java:258) > > at > > dtag.dns.torque.BaseOrdersPeer.doInsert(BaseOrdersPeer.java:634) > > at dtag.dns.torque.BaseOrders.save(BaseOrders.java:976) > > at dtag.dns.torque.BaseDnsObject.save(BaseDnsObject.java:107) > > at dtag.dns.torque.Orders.save(Orders.java:56) > > at dtag.dns.orders.Order.execute(Order.java:194) > > at dtag.dns.orders.Order.execute(Order.java:90) > > > > Looking thru the torque code and doing some logging, I found out, that > the > > table to which I > > want to save is not contained in the table map (BasePeer.java, line > 696). > > > The funny thing is > > that this occurs only when I run the testcases (I'm using > strutstestcases > > > 2.1.3 with struts 1.2.4). > > Normaly the app is runnung with apache and tomcat, If so, there's no > > exception and the table > > is contained in the table map. > > > > Does anyone has faced this or a similar problem and has got a solution > or > > > hint for me ? > > > > Thanks in advance, > > Arndt > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: torque-user-unsubscribe@xxxxxxxxxxxxx > > For additional commands, e-mail: torque-user-help@xxxxxxxxxxxxx > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@xxxxxxxxxxxxx > For additional commands, e-mail: torque-user-help@xxxxxxxxxxxxx > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@xxxxxxxxxxxxx > For additional commands, e-mail: torque-user-help@xxxxxxxxxxxxx > |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: NullPointerException while running testcases: 00113, a . winter |
|---|---|
| Next by Date: | Foreign key integrity constraints and Transactions: 00113, John Harris |
| Previous by Thread: | RE: NullPointerException while running testcasesi: 00113, a . winter |
| Next by Thread: | Foreign key integrity constraints and Transactions: 00113, John Harris |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |