Re: Strange NullPointerException

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Mar 12 2005 - 00:13:25 EST

  • Next message: Andrus Adamchik: "Re: Relationship between tables"

    Hmm... now after re-reading this again I realized that this popped up
    before. A search from Cayenne web site for
    "validateForSave+NullPointerException" showed this:

    http://www.objectstyle.org/cayenne/lists/cayenne-user/2005/01/0078.html

    I think Jürgen's problem is the same. BTW, in Cayenne 1.2 we added
    better diagnostics, so that the error message is more meaningful.

    Andrus

    On Mar 11, 2005, at 11:51 PM, Alex Gunawan Wibowo wrote:

    > Could be wrong... but have you tried
    > BasicServletConfiguration.getDefaultContext(request.getSession())??
    > Have you bind the DataContext in web.xml??
    >
    > Again.. I could be wrong...
    >
    > --- Jürgen Saar <jsaa..eb.de> wrote:
    >> I actually set up a new project ...
    >> the first with postgres and PK from cayenne
    >>
    >> The following source:
    >> ...
    >> DataContext context =
    >> DataContext.createDataContext();
    >>
    >> TrAddress addr = (TrAddress)
    >> context.createAndRegisterNewObject(TrAddress.class);
    >> addr.setCity("AnyWhere");
    >>
    >> context.commitChanges();
    >> ...
    >>
    >> The Reaktion:
    >>
    >> Exception in thread "main"
    >> java.lang.NullPointerException
    >> at
    >>
    > org.objectstyle.cayenne.CayenneDataObject.validateForSave(CayenneDataOb
    > ject.java:575)
    >> at
    >>
    > org.objectstyle.cayenne.CayenneDataObject.validateForInsert(CayenneData
    > Object.java:700)
    >> at
    >>
    > org.objectstyle.cayenne.access.ObjectStore.validateUncommittedObjects(O
    > bjectStore.java:937)
    >> at
    >>
    > org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.ja
    > va:1260)
    >> at
    >>
    > org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.ja
    > va:1236)
    >> at
    >> org.jsaar.test.JustForTry.main(JustForTry.java:31)
    >>
    >>
    >> any idea?
    >> ---Juergen---



    This archive was generated by hypermail 2.0.0 : Sat Mar 12 2005 - 00:13:32 EST