I am migrating to Java 9 and have encountered some issues, which I am sure will eventually be addressed by a Java 9 compatible ObjectDB future release, but while waiting for that release, perhaps you could give some advice for my current issues.
Firstly, I created my own ObjectDB module. I try to run com.objectdb.Enhancer from that module, but ObjectDB gives the error below. My guess is the error is because ObjectDB is trying to detect its objectdb.home location by looking at its objectdb.jar location, which is not valid in a Java module environment.
Example command:
java -Dobjectdb.conf=ObjectDb.conf --module-path com.objectdb.jar --module com.objectdb/com.objectdb.Enhancer
Command output:
com.objectdb.o.UserException: Configuration is not found - try setting objectdb.conf at com.objectdb/com.objectdb.o.MSG.d(MSG.java:62) at com.objectdb/com.objectdb.o.CFG.<clinit>(CFG.java:54) at com.objectdb/com.objectdb.o.JEN.<init>(JEN.java:67) at com.objectdb/com.objectdb.Enhancer.main(Enhancer.java:32) Exception in thread "main" java.lang.ExceptionInInitializerError at com.objectdb/com.objectdb.o.JEN.<init>(JEN.java:67) at com.objectdb/com.objectdb.Enhancer.main(Enhancer.java:32) Caused by: com.objectdb.o.UserException: Invalid configuration in 'internal' - Check permissions. at com.objectdb/com.objectdb.o.MSG.d(MSG.java:75) at com.objectdb/com.objectdb.o.CFG.<clinit>(CFG.java:61) ... 2 more Caused by: com.objectdb.o.UserException: Configuration is not found - try setting objectdb.conf at com.objectdb/com.objectdb.o.MSG.d(MSG.java:62) at com.objectdb/com.objectdb.o.CFG.<clinit>(CFG.java:54) ... 2 more
So I decided I would just make the call from the original object.jar instead of my self created Java module of its contents. This lead to my current issue. I have been unable to resolve this issue. I have tried all sorts of Java workarounds with no luck. (For example, --add-exports, --add-opens, etc.)
Example command:
java -Dobjectdb.conf=ObjectDb.conf --class-path objectdb.jar;MyDir com.objectdb.Enhancer com.mystuff.*
Command output:
[ObjectDB 2.7.1_09] Failed to process class file of type 'com.unilogical.moxydox.server.Email' (error 422) com.objectdb.o.UserException: Failed to process class file of type 'com.unilogical.moxydox.server.Email' at com.objectdb.o.MSG.d(MSG.java:75) at com.objectdb.o.JEL.A(JEL.java:446) at com.objectdb.o.JEN.m(JEN.java:101) at com.objectdb.Enhancer.main(Enhancer.java:33) Caused by: com.objectdb.o.UserException: Failed to generate dynamic type jdk.internal.reflect.SerializationConstructorAccessorImpl at com.objectdb.o.MSG.d(MSG.java:75) at com.objectdb.o.ACL.d(ACL.java:167) at com.objectdb.o.BCL.loadClass(BCL.java:59) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496) at java.base/jdk.internal.misc.Unsafe.defineClass0(Native Method) at java.base/jdk.internal.misc.Unsafe.defineClass(Unsafe.java:1173) at java.base/jdk.internal.reflect.ClassDefiner.defineClass(ClassDefiner.java:63) at java.base/jdk.internal.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:400) at java.base/jdk.internal.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:394) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/jdk.internal.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:393) at java.base/jdk.internal.reflect.MethodAccessorGenerator.generateSerializationConstructor(MethodAccessorGenerator.java:112) at java.base/jdk.internal.reflect.ReflectionFactory.generateConstructor(ReflectionFactory.java:434) at java.base/jdk.internal.reflect.ReflectionFactory.newConstructorForSerialization(ReflectionFactory.java:426) at java.base/java.io.ObjectStreamClass.getSerializableConstructor(ObjectStreamClass.java:1417) at java.base/java.io.ObjectStreamClass.access$1500(ObjectStreamClass.java:75) at java.base/java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:500) at java.base/java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:475) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:475) at java.base/java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:372) at java.base/java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:216) at com.objectdb.o.TDF.<init>(TDF.java:194) at com.objectdb.o.ANT.V(ANT.java:874) at com.objectdb.o.SCM.r(SCM.java:224) at com.objectdb.o.JEW.aI(JEW.java:310) at com.objectdb.o.JEW.aH(JEW.java:261) at com.objectdb.o.JEW.aH(JEW.java:224) at com.objectdb.o.JEW.aG(JEW.java:188) at com.objectdb.o.JEL.A(JEL.java:436) ... 2 more Caused by: com.objectdb.o.UserException: Failed to generate dynamic type jdk.internal.reflect.ConstructorAccessorImpl at com.objectdb.o.MSG.d(MSG.java:75) at com.objectdb.o.ACL.d(ACL.java:167) at com.objectdb.o.BCL.loadClass(BCL.java:59) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496) at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1007) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:868) at com.objectdb.o.ACL.d(ACL.java:155) ... 30 more Caused by: java.lang.IllegalAccessError: class jdk.internal.reflect.ConstructorAccessorImpl loaded by com/objectdb/o/BCL cannot access jdk/internal/reflect superclass jdk.internal.reflect.MagicAccessorImpl at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1007) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:868) at com.objectdb.o.ACL.d(ACL.java:155) ... 36 more
Answering the first question is just a bonus. The second issue is the one I really need to resolve. Otherwise I guess my only recourse is to also install Java 8 and use it just to run ObjectDB's Enhancer.
Thank you for any insights you may offer!