501 words

Upgrade to Java 8 won't run

#1
2014-11-16 20:44

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
greymatter
greymatter's picture
Joined on 2014-03-23
User Post #2
#2
2014-11-16 23:41

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
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,085
#3
2014-11-17 14:47

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?

greymatter
greymatter's picture
Joined on 2014-03-23
User Post #3
#4
2014-11-18 08:20

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
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,086
#5
2014-11-19 15:09

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

greymatter
greymatter's picture
Joined on 2014-03-23
User Post #4
#6
2014-11-19 18:17

Please use a support ticket to upload private files.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,087
#7
2014-11-20 05:06

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?

greymatter
greymatter's picture
Joined on 2014-03-23
User Post #5
#8
2014-11-20 20:37


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

AlphaOne
AlphaOne's picture
Joined on 2013-03-14
User Post #17
#9
2014-11-21 11:48
@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.
greymatter
greymatter's picture
Joined on 2014-03-23
User Post #6
#10
2014-11-21 13:58

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.

AlphaOne
AlphaOne's picture
Joined on 2013-03-14
User Post #18
#11
2014-11-24 17:21

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

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,088
#12
2014-11-25 04:53

This fixed the problem.  Thank you very much!

greymatter
greymatter's picture
Joined on 2014-03-23
User Post #7

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel