db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vlada Djurovic <vdjuro...@gmail.com>
Subject Re: hsqldb and NullPointerException
Date Fri, 17 Jun 2005 09:25:42 GMT
> Hi,
> 
> can you append a stack trace and (if it is not inside Torque) the relevant
> part of code ?
> It sounds a bit like a configuration issue. The classpath is improbable, I
> have never seen a NullPointerException thrown because of a classpath issue
> 
>             Thomas
> 
Here's a part of stack trace:
--------------------------------------------------
Exception occurred during event dispatching:
java.lang.NullPointerException
        at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:661)
        at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:603)
        at com.euroicc.cardiobip.om.BasePatientPeer.doInsert(BasePatientPeer.jav
a:223)
        at com.euroicc.cardiobip.om.BasePatientPeer.doInsert(BasePatientPeer.jav
a:196)
        at com.euroicc.cardiobip.gui.NewPatientDialog.OKButtonActionPerformed(Ne
wPatientDialog.java:413)
-----------------------------------------------------------------------------------
And the code:

++++++++++++++++++++++++++++++++
 Criteria crit=new Criteria();
            crit.setDbName(Torque.getDefaultDB());
            System.out.println("Database="+crit.getDbName());//for debugging
            crit.add(PatientPeer.FIRSTNAME,firstNameField.getText());
            crit.add(PatientPeer.LASTNAME,lastNameField.getText());
            crit.add(PatientPeer.HEIGHT,(new
Integer(heightField.getText())).intValue());
            crit.add(PatientPeer.WEIGHT,(new
Integer(weightField.getText())).intValue());
            crit.add(PatientPeer.CHEST,(new
Integer(chestField.getText())).intValue());
            crit.add(PatientPeer.BIRTHDATE,dateOfBirth);
            
            ObjectKey ok=PatientPeer.doInsert(crit); ///HERE IS THE EXCEPTION
++++++++++++++++++++++++++++++++++++++++++++++

I did some lookin in Torque BasePeer class source, and it seems that
it can't find appropriate table:

        DatabaseMap dbMap = Torque.getDatabaseMap(criteria.getDbName());
        TableMap tableMap = dbMap.getTable(tableName);  //THIS SEEMS
TO RETURN null
        Object keyInfo = tableMap.getPrimaryKeyMethodInfo();//EXCEPTION NPE

I hope you can shed some light on this. Thanks


> 
> Vlada Djurovic <vdjurovic@gmail.com> schrieb am 17.06.2005 09:11:09:
> 
> > > Hi,
> > >
> > > The usual way to cope with a null pointer exception is
> > > 1) compile the sources with the debug option
> > > 2) look at the stack trace to find out exactly where the exception
> occurs
> > > 3) look at the indicated line in the source code to see which object is
> > > null
> > > 4) check (in the source code or elsewhere) why the object is null
> > >
> > > Did you already do that ?
> > >
> > >     Thomas
> >
> > Yes, I did that, and everything else I could think of, but couldn't
> > find anything wrong. As I said, it works perfectly inside the IDE, but
> > not outside.
> > When I run the app standalone, I can connect to database, do simple
> > querries, but if I try to do INSERT, UPDATE,DELETE or join, I get the
> > NPE.
> > First I thought it's a classpath issue, but I guess, if I can connect
> > to database and do some things, than the classpath and configuration
> > are OK, right? I use the same libs in the IDE and outside it, so it
> > should be OK too.
> > This is really frustrating:-(
> >
> > Thanks for a tip anyway.
> >
> > ---------------------------------------------------------------------
> > 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