Upgrade to Java 8 won't run

#1

I've been using ObjectDB with Groovy 2.1 and Java 7 for nearly a year.  Today, I updated everything to the latest revs (Groovy 2.3.6, Java 1.8.0_25, and ObjectDB 2.5.7_05), and now my application fails when opening the database.

It's dying on one of these lines:

  emf = Persistence.createEntityManagerFactory (dbName)
  em = emf.createEntityManager()
  em.setFlushMode(FlushModeType.AUTO)
  ObjectDB.em = em

 

Exception in thread "main" java.lang.ExceptionInInitializerError
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1844)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3690)
at org.codehaus.groovy.runtime.callsite.ClassMetaClassGetPropertySite.getProperty(ClassMetaClassGetPropertySite.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
at com.tradeunafraid.TradeUnafraid.init(TradeUnafraid.groovy:127)
at com.tradeunafraid.TradeUnafraid$init$0.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at com.tradeunafraid.TradeUnafraid.run(TradeUnafraid.groovy:64)
at com.tradeunafraid.TradeUnafraid$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at com.tradeunafraid.TradeUnafraid.main(TradeUnafraid.groovy:723)
Caused by: com.objectdb.o._PersistenceException: Failed to generate dynamic type java.util.HashMap$Entry
at com.objectdb.o._PersistenceException.b(_PersistenceException.java:45)
at com.objectdb.o.JPE.g(JPE.java:145)
at com.objectdb.o.ERR.f(ERR.java:56)
at com.objectdb.o.OST.onObjectDBError(OST.java:596)
at com.objectdb.jpa.EMF.createEntityManager(EMF.java:260)
at javax.persistence.EntityManagerFactory$createEntityManager.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at com.tradeunafraid.TUActor.<init>(TUActor.groovy:53)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
at com.tradeunafraid.TUActor.<clinit>(TUActor.groovy)
... 21 more
Caused by: com.objectdb.o.UserException: Failed to generate dynamic type java.util.HashMap$Entry
at com.objectdb.o.MSG.d(MSG.java:75)
at com.objectdb.o.ACL.d(ACL.java:167)
at com.objectdb.o.STL.g(STL.java:97)
at com.objectdb.o.TYM.findClass(TYM.java:1036)
at com.objectdb.o.ACL.loadClass(ACL.java:131)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.objectdb.o.TYM.ay(TYM.java:1013)
at com.objectdb.o.UTY.initSysType(UTY.java:331)
at com.objectdb.o.TYS.l(TYS.java:166)
at com.objectdb.o.TYM.ae(TYM.java:511)
at com.objectdb.o.TYM.<init>(TYM.java:194)
at com.objectdb.o.OMF.ao(OMF.java:811)
at com.objectdb.o.OMF.an(OMF.java:765)
at com.objectdb.jpa.EMF.an(EMF.java:238)
at com.objectdb.o.OMF.am(OMF.java:693)
at com.objectdb.jpa.EMF.createEntityManager(EMF.java:257)
... 36 more
Caused by: java.lang.SecurityException: Prohibited package name: java.util
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
at com.objectdb.o.ACL.d(ACL.java:155)
... 50 more
#2

It seems that this exception is caused by having java.util.HashMap.Entry in the list of types in your database, since apparently this internal Java 7 type is not part of Java 8.

Having this type in the database is unexpected and may be the result of a non standard operation. Maybe you can provide more information on direct use of java.util.HashMap.Entry in your application that might have been caused this issue.

ObjectDB Support
#3

All my code is written in Groovy.  The objects stored in ObjectDB are Groovy objects and contain both lists and maps. 

This worked perfectly in ObjectDB 2.5.4.  Somehow, in the updates of Groovy, Java, and ObjectDB, opening that same database is now causing the exception I originally posted.

Is there some kind of database migration that needs to take place?  Would going back to 2.5.4 help?

#4

The cause of this issue is unclear. ObjectDB should not use java.util.HashMap.Entry directly. It may be related to Groovy or to a specific use of ObjectDB. We will try to produce a fix in the next days. If you can share a sample database with this issue it may help.

 

ObjectDB Support
#5

Is it possible for me to email it to you, rather than posting it publicly?

#6

Please use a support ticket to upload private files.

ObjectDB Support
#7

I have found that I can no longer open my old databases with either the objectdb-2.5.4_04 or objectdb-2.5.7_05 explorer.  The only thing that seems to make sense is that Java 8 is the source of the problem.  I am using Java(TM) SE Runtime Environment (build 1.8.0_25-b17).

Is ObjectDB compatible with Java 8?

#8


I'm using ObjectDB 2.5.7_05 with some fairly complex code and Java 8 with no problems.

#9

@AlphaOne, I assume you're referring to Java, not Groovy? I wonder if it's the combination of Groovy objects and Java 8 which is causing my problem.

#10

Yes, I am using just Java and no Groovy.

And yes, it does sound reasonable to me to suspect Groovy as the source of the problem given my excellent experience with Java 8 and ObjectDB 2.5.7_05.

#11

Please try build 2.5.7_06, which includes a workaround for handling this unexpected state.

ObjectDB Support
#12

This fixed the problem.  Thank you very much!

Reply