ObjectDB ObjectDB

Issue #2882: Unexpected Exception (java.lang.NullPointerException: Cannot invoke "com.objectdb.o.ORS.Z9())

Type: DiscussionVersion: 2.8.7Priority: NormalStatus: ActiveReplies: 4
#1

In one of our applications, we encounter an unexpected problem. Commits fail with the following exception:

com.objectdb.o.UserException: Failed to commit transaction: Cannot invoke "com.objectdb.o.ORS.Z9()" because "<parameter1>" is null
    at com.objectdb.o.MSG.a(MSG.java:77)
    at com.objectdb.jpa.EMImpl.commit(EMImpl.java:297)
    at de.advolux.jpa.network.rmi.session.StandAloneDatabaseConnector.EndTransaction(StandAloneDatabaseConnector.java:803)
    at de.advolux.jpa.network.rmi.session.StandAlonePM.EndTransaction(StandAlonePM.java:534)
    at de.advolux.jpa.network.replicate.ExtReplicationImportHelper.DoZwischenCommit(ExtReplicationImportHelper.java:400)
    at de.advolux.jpa.network.replicate.ExtReplicationImportHelper.ImportGeänderteObjekte(ExtReplicationImportHelper.java:346)
    at de.advolux.jpa.network.replicate.ExtReplicationImportHelper.run(ExtReplicationImportHelper.java:167)
    at de.advolux.jpa.network.replicate.ExtReplicationImportHelper.ImportAndWait(ExtReplicationImportHelper.java:126)
    at de.advolux.reorg.persistent.ReorgManager.run(ReorgManager.java:147)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.NullPointerException: Cannot invoke "com.objectdb.o.ORS.Z9()" because "<parameter1>" is null
    at com.objectdb.o.TYW.<init>(TYW.java:109)
    at com.objectdb.o.ENH.g(ENH.java:228)
    at com.objectdb.o.ENT.E(ENT.java:926)
    at com.objectdb.o.ENT.D(ENT.java:891)
    at com.objectdb.o.STA.F(STA.java:506)
    at com.objectdb.o.STM.f(STM.java:455)
    at com.objectdb.o.OBM.aU(OBM.java:854)
    at com.objectdb.o.OBM.aH(OBM.java:782)
    at com.objectdb.jpa.EMImpl.commit(EMImpl.java:292)
    ... 8 more

The application is pretty straight forward, I think. Data is read from an XML file, entities are created in memory based on the XML data and persisted to a new ObjectDB file. We regularly commit transactions (e.g. after 1000 persisted entities), then continue with the import in a new transaction.

The issue does not always occur when running the application. Do you know any reason, why this NullPointerException could happen on commit?

 

Also, when analyzing this problem, we encountered an issue with the logging mechanism. We enabled full logging (logger name="*" level="debug") and logged to a file with limited size. We did not configure a log-archive (log-archive path="" retain="0"). That caused an exception when the log file reached its size limit. Here's the stack trace of that issue:

com.objectdb.o.UserException: Failed to create a new file ''
    at com.objectdb.o.MSG.a(MSG.java:77)
    at com.objectdb.o.LFL.m(LFL.java:887)
    at com.objectdb.o.LFL.x(LFL.java:827)
    at com.objectdb.o.LFL.x(LFL.java:796)
    at com.objectdb.o.LFL.Yv(LFL.java:523)
    at com.objectdb.o.LFL.l(LFL.java:485)
    at com.objectdb.o.LFL.a(LFL.java:469)
    at com.objectdb.o.LFL.j(LFL.java:658)
    at com.objectdb.o.LGM.j(LGM.java:329)
    at com.objectdb.o.LGR.c(LGR.java:431)
    at com.objectdb.o.LGR.h(LGR.java:315)
    at com.objectdb.o.MSF.YQ(MSF.java:308)
    at com.objectdb.o.OMF.k(OMF.java:1008)
    at com.objectdb.o.OMF.close(OMF.java:943)
    at de.advolux.jpa.network.DatabaseHelper.CloseFactory(DatabaseHelper.java:81)
    at de.advolux.jpa.network.server.ServerDatabase.ExitDatabase(ServerDatabase.java:157)
    at de.advolux.jpa.network.local.XToolClientManager.Abmelden(XToolClientManager.java:1525)
    at de.advolux.jpa.network.Network.DisconnectFromDatabase(Network.java:246)
    at de.advolux.jpa.network.replicate.ExtReplicationImportHelper.CloseBase(ExtReplicationImportHelper.java:504)
    at de.advolux.jpa.network.replicate.ExtReplicationImportHelper.run(ExtReplicationImportHelper.java:183)
    at de.advolux.jpa.network.replicate.ExtReplicationImportHelper.ImportAndWait(ExtReplicationImportHelper.java:120)
    at de.advolux.reorg.persistent.ReorgManager.run(ReorgManager.java:147)
    at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.io.FileNotFoundException:  (No such file or directory)
    at java.base/java.io.RandomAccessFile.open0(Native Method)
    at java.base/java.io.RandomAccessFile.open(RandomAccessFile.java:344)
    at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:259)
    at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:213)
    at com.objectdb.o.LFL.m(LFL.java:874)
    ... 21 more
edit
delete
#2

The first stack trace indicates an unexpected state of an entity object during commit, as somehow it seems to be disconnected from the relevant EntityManager. This happens on a check whether the entity object has been modified by comparing its up to date content to a snapshot of the object when retrieved from the database.

In most cases this check is not needed when entity classes are enhanced, so enhancing the class may solve the issue. Note that mixing enhanced and non-enhanced classes is not supported and may cause various issues, so double check that all your entity classes are enhanced.

Something else to check is that all objects are retrieved from the same EntityManager object as mixing objects across EntityManager instances is not allowed and  can cause various issues.

If the issue is not solved and you can share a running test case that produces the exception we will look into it.

ObjectDB Support
edit
delete
#3

There is only one EntityManager, so this should not be an issue. Also, our entity classe are all enhanced. But in the log file, I noted a few occurrences of a message stating that a certain type has not been enhanced (the type is not an Entity, but an Embeddable). Could that be the cause for this issue?

Also, is it possible to see in the log file, on which type this check you mentioned fails?

edit
delete
#4

Embeddable classes should also be enhanced. The issue might be related to these classes.

Unfortunately it seems that the relevant type is not specified in the log or in an error message - we will fix it.

Are you using version 2.8.7? Can you try the last version to see if there is any difference?

Are there any recent schema changes to this database or any other changes specific to this application / user before this error started?

ObjectDB Support
edit
delete
#5

Version 2.8.9_07 improves the error message, so it should show the relevant class name.

Your report regarding the log file was moved to a new separate thread.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.