ObjectDB ObjectDB

PersistenceManager.getObjectsById(Collection,boolean) throwing JDOException

#1

I have a call to getObjectsById(Collection,boolean) that is throwing a JDOException the first time I'm attempting to retrieve an object. If I try again, then the second request succeeds.

Any idea why this might occur?

We're using ObjectDB 2.2.4_02. The collection being passed in is a HashSet<Object> containing a single oid object (the method is written to support multiple objects, but it seems to only be failing irregularly when only a single oid is present). I'm passing false in as the verification argument.

What happens if getObjectsById() is called with an empty collection?

edit
delete
#2

There are no known issues with this method. If you pass an empty collection the method should return an empty collection. It should work with single or multiple IDs and with any collection type.

Please post a complete error message and stack trace.

A test case the demonstrates the issue may help.

 

ObjectDB Support
edit
delete
#3

Ok, I think it must be a problem with the way I'm keeping track of my oids. If I call getObjectById() with an oid that is not known it'll throw a NullPointerException correct?

edit
delete
#4

If objects are not found - an exception in the following format is expected:

Exception in thread "main" [ObjectDB 2.2] javax.jdo.JDOUserException
Failed to find multiple entities (error 636)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:512)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:535)
 at com.objectdb.test.bug.T296.main(T296.java:21)
NestedThrowablesStackTrace:
[ObjectDB 2.2] javax.jdo.JDOObjectNotFoundException
Entity is not found: com.objectdb.test.MyEntity#1 (error 631)
 at com.objectdb.jdo.PMImpl.getObjectById(PMImpl.java:451)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:483)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:535)
 at com.objectdb.test.bug.T296.main(T296.java:21)
[ObjectDB 2.2] javax.jdo.JDOObjectNotFoundException
Entity is not found: com.objectdb.test.MyEntity#2 (error 631)
 at com.objectdb.jdo.PMImpl.getObjectById(PMImpl.java:451)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:483)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:535)
 at com.objectdb.test.bug.T296.main(T296.java:21)

I see that some NullPointerException-s were also added as cause exception - just ignore them - they will be removed in the next build.

ObjectDB Support
edit
delete
#5

Actually it is the NullPointerExceptions that I'm getting. Your advice to ignore them explains why it would work the second time around.  I believe that the same issue is occurring on calls to deletePersistentAll(Collection). That is failing on occasion with a NullPointerException.  I can't get exact stack traces as this is running on a classified lab system, but I wrote down the following notes from our logs:

[ObjectDB 2.2.4_02] javax.jdo.JDOUserException Failed to find multiple entities (error 636)

The topmost entry of the stack trace references PMImpl.getObjectsById() on line 511. At the bottom of that stack trace I see:

Nested Throwable Stack Trace:

java.lang.NullPointerException

java.lang.NullPointerException

When is the next build expected?

edit
delete
#6

Next build could be generated as soon as the problem is fully understood. I am not sure that the nested NullPointerException when an object is not found is the real problem.

Could you please check the log files? You may find the complete stack trace.

ObjectDB Support
edit
delete
#7

OK looks like there are two different versions of the NPE that are happening, does this help:

java.lang.NullPointerException
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:495)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:534)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:548)
 at nuwc.iof.data.AbstractObjectDBDatabase.handleCommands(AbstractObjectDBDatabase.java:259)

java.lang.NullPointerException
 at com.objectdb.o.ENT.r(ENT.java:203)
 at com.objectdb.o.ENT.p(ENT.java:176)
 at com.objectdb.o.ENT.v(ENT.java:363)
 at com.objectdb.o.ENT.w(ENT.java:381)
 at com.objectdb.o.ENT.F(ENT.java:519)
 at com.objectdb.o.LDR.H(LDR.java:404)
 at com.objectdb.o.LDR.G(LDR.java:286)
 at com.objectdb.o.OBC.aM(OBC.java:1049)
 at com.objectdb.o.OBC.aJ(OBC.java:962)
 at com.objectdb.o.OBC.aI(OBC.java:881)
 at com.objectdb.o.OBC.aD(OBC.java:705)
 at com.objectdb.jdo.PMImpl.getObjectById(PMImpl.java:435)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:483)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:534)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:548)
 at nuwc.iof.data.AbstractObjectDBDatabase.handleCommands(AbstractObjectDBDatabase.java:259)

 

edit
delete
#8

The stack trace provides general idea about the problem.

Please try build 2.2.5_02 - it is an attempt to fix the bug but with no test case I cannot tell if it works or not.

ObjectDB Support
edit
delete
#9
Thank you, I'll try it out first thing in the morning!
edit
delete
#10

Ok, I tried out the 2.2.5_02 build and it looks better, but I'm still getting NullPointerExceptions on calls to getObjectsById(). Now instead of two different NPE stack traces there is only one that is coming up repeatedly:

[2011-05-25 09:04:53 #2 *]
java.lang.NullPointerException
 at com.objectdb.o.ENT.r(ENT.java:203)
 at com.objectdb.o.ENT.p(ENT.java:176)
 at com.objectdb.o.ENT.v(ENT.java:363)
 at com.objectdb.o.ENT.w(ENT.java:381)
 at com.objectdb.o.ENT.F(ENT.java:519)
 at com.objectdb.o.LDR.H(LDR.java:404)
 at com.objectdb.o.LDR.G(LDR.java:286)
 at com.objectdb.o.LDR.D(LDR.java:204)
 at com.objectdb.o.OBC.aK(OBC.java:1032)
 at com.objectdb.o.OBC.aI(OBC.java:933)
 at com.objectdb.o.OBC.aD(OBC.java:705)
 at com.objectdb.jdo.PMImpl.getObjectById(PMImpl.java:435)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:483)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:535)
 at com.objectdb.jdo.PMImpl.getObjectsById(PMImpl.java:549)
 at nuwc.iof.data.AbstractObjectDBDatabase.handleCommands(AbstractObjectDBDatabase.java:259)
 at peoiws5.track.server.DefaultTrackServer.processCommands(DefaultTrackServer.java:347)
 at peoiws5.track.server.DefaultTrackServer.handleNextCommands(DefaultTrackServer.java:333)
 at peoiws5.track.server.DefaultTrackServer.handleNextCommand(DefaultTrackServer.java:273)
 at peoiws5.track.server.DefaultTrackServer.access$100(DefaultTrackServer.java:75)
 at peoiws5.track.server.DefaultTrackServer$CommandProcessor.run(DefaultTrackServer.java:405)
 at java.lang.Thread.run(Unknown Source)

 

edit
delete
#11

I see something else. Please try build 2.2.5_03, but again I cannot tell yet if it solves the problem.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.