db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <Fisc...@seitenbau.net>
Subject RE: NullPointerException while running testcases
Date Fri, 19 Nov 2004 18:47:19 GMT




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@telenet-ag.de 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@seitenbau.net>
> 19.11.2004 09:52
> Please respond to "Apache Torque Users List"
>
>
>         To:     "Apache Torque Users List" <torque-user@db.apache.org>
>         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@telenet-ag.de 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@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


Mime
View raw message