NullPointerException in ENH.g(ENH.java:401)

#1

Hi,

I experience a NullPointerException inside the objectdb code with the following stacktrace:

Exception in thread "main" java.lang.NullPointerException
at com.objectdb.o.ENH.g(ENH.java:401)
at com.objectdb.o.OBC.aM(OBC.java:951)
at com.objectdb.o.OBC.UZ(OBC.java:822)
at com.objectdb.o.TYR.aF(TYR.java:715)
at com.objectdb.o.TYR.completeRead(TYR.java:562)
at com.objectdb.o.TYR.readElement(TYR.java:294)
at com.objectdb.o.UTY.readAndAdjust(UTY.java:1553)
at com.objectdb.o.ABT.readArray(ABT.java:594)
at com.objectdb.o.CLT.readArray(CLT.java:354)
at com.objectdb.o.CLT.readArray(CLT.java:339)
at com.objectdb.o.CLT.H(CLT.java:289)
at com.objectdb.o.TYT.extractCollection(TYT.java:94)
at com.objectdb.o.ENT.extractCollection(ENT.java:1529)
at objectdb.java.util.ArrayList.__odbBeforeAccess(Unknown Source)
at objectdb.java.util.ArrayList.stream(Unknown Source)
at com.domain.entities.Entity.handleOrphans(Entity.java:170)

This happens when I try to read a @OneToMany list collection of other entity classes. We use objectdb in embedded mode and this error seems to happen after a few ungraceful shutdowns of the database (e.g. quit the process without proper shutdown).

Thanks in advance
Markus Ritter

#2

The stack trace indicates an unexpected object type on reading a list of objects from the database.

Please check your database file for errors using the ObjectDB Doctor, and if necessary use the Doctor to repair the database.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Hi,

I already used the objectdb doctor tool but the issue remains (I analysed and repaired). The entity which fails to read could be read before without any issues so it seems that the database file gets corrupted after time or the internal structure does not match anymore. Unfortunately I cannot reproduce the error on request since I do not know the exact event which causes this state. Is there any other way to fix the database file?

Thanks in advance
Markus Ritter

#4

We can check the database and possibly repair it (by finding why the Doctor doesn't repair it and improving the Doctor) - if you can share the database with us (e.g. upload it in a private support ticket, or provide a link to it).

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#5

The problem seems to be related to moving an entity class to a new package without backing this operation with a schema change declaration in the configuration file.

Two different classes with a similar name exist in the database:

  • com.mvolution.domain.entities.event.Participant:
    transient (non entity class), used as the field type of Event.participants.
  • com.mvolution.domain.entities.event.participant.Participant:
    an entity class with no instances.

Adding a schema change now may not help, as there are already two different classes in the database.

Please try to move the com.mvolution.domain.entities.event.participant.Participant class back to com.mvolution.domain.entities.event.Participant, and then open the database.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#6

Hi,

thanks for your fast response. You were right, I forgot about this schema change. Glad you found it...

Thanks
Markus Ritter

#7

Good. Thank you for the update.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login