Home » Support » Forum » ClassCastException on closing PersistenceManager

ClassCastException on closing PersistenceManager

#1

Hi,

I am using ObjectDB 2.6.3.b03 via JDO. Today I got the following exception while closing the PersistenceManager after reading the DB:

java.lang.ClassCastException: com.objectdb.o.ENT cannot be cast to com.objectdb.o.EMT
at com.objectdb.o.MMM.ah(MMM.java:1117)
at com.objectdb.o.MMM.ai(MMM.java:1133)
at com.objectdb.o.MMM.ag(MMM.java:1096)
at com.objectdb.o.EMT.n(EMT.java:201)
at com.objectdb.o.MMM.ah(MMM.java:1121)
at com.objectdb.o.MMM.ag(MMM.java:1086)
at com.objectdb.o.EMT.n(EMT.java:201)
at com.objectdb.o.MMM.ah(MMM.java:1121)
at com.objectdb.o.MMM.ai(MMM.java:1133)
at com.objectdb.o.MMM.ag(MMM.java:1096)
at com.objectdb.o.ENT.D(ENT.java:356)
at com.objectdb.o.STA.af(STA.java:835)
at com.objectdb.o.STM.D(STM.java:367)
at com.objectdb.o.OBC.ag(OBC.java:198)
at com.objectdb.o.OBM.close(OBM.java:198)
at eu.extech.serverImpl.jdo.JDOConnection.close(Unknown Source)

 

the method on the bottom of the stack trace looks like this:

private PersistenceManager persistenceManager;

public void close() {
  if( ! this.persistenceManager.isClosed()) {
   if (this.persistenceManager.currentTransaction().isActive()) {
    this.persistenceManager.currentTransaction().rollback();
   } 
   this.persistenceManager.close();
  }
}

It looks like it's related to the state of the DB. I replaced the non-working DB file (although the Doctor was saying the Db file has no errors) with an older backup and the code was running without errors.

However it worries me how did it com to this state and if it can happen again.

Maybe there is something I can do to prevent it next time.

 

#2

The stack trace indicates an issue in the implementation of the new embeddable detachment feature. Since this feature was requested by you recently and requires enabling explicitly you may be the only user affected.

Build 2.6.4_01 includes an attempt to fix this exception.

This issue cannot damage the database, so restarting your application with the same database (instead of a backup database) should be safe.

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

Today I got a similar but different exception on the same database also on closing PersistenceManager:

java.lang.ClassCastException: com.objectdb.spi.DetachedTracker cannot be cast to com.objectdb.o.EMT
at com.objectdb.o.MMM.ah(MMM.java:1117)
at com.objectdb.o.MMM.ai(MMM.java:1133)
at com.objectdb.o.MMM.ag(MMM.java:1096)
at com.objectdb.o.EMT.n(EMT.java:201)
at com.objectdb.o.MMM.ah(MMM.java:1121)
at com.objectdb.o.MMM.ag(MMM.java:1086)
at com.objectdb.o.EMT.n(EMT.java:201)
at com.objectdb.o.MMM.ah(MMM.java:1121)
at com.objectdb.o.MMM.ai(MMM.java:1133)
at com.objectdb.o.MMM.ag(MMM.java:1096)
at com.objectdb.o.ENT.D(ENT.java:356)
at com.objectdb.o.STA.af(STA.java:835)
at com.objectdb.o.STM.D(STM.java:371)
at com.objectdb.o.OBC.ag(OBC.java:198)
at com.objectdb.o.OBM.close(OBM.java:198)
at eu.extech.serverImpl.jdo.JDOConnection.close(Unknown Source)

 

I had to return again to a working backup of the DB. It is quite alarming.

#4

I just read ur answer. Once the bug appeared, it was coming also after restart of the application right away. Only returning to an older backup seems to help.
I will try now the new build of objectDB with the fix.

#5

#3 stack is the same issue. Unfortunately this is the risk of being the first to use a new feature.

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

With the fixed version the application starts again without need to return to backup.

So far so good.

Thanks!


Post Reply

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