Greetings,
I am trying to get my app running on Java 10 (up to now it runs on Java 8) and with the latest version of ObjectDB it enhances fine, but during runtime when first trying to instantiate the PersistenceManager, it gives me the following error
java.lang.NoClassDefFoundError: javax/transaction/Synchronization at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1009) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:801) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:699) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:622) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499) at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1009) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:801) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:699) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:622) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:374) at javax.jdo.JDOHelper$18.run(JDOHelper.java:1944) at java.base/java.security.AccessController.doPrivileged(Native Method) at javax.jdo.JDOHelper.forName(JDOHelper.java:1941) at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1152) at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:800) at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:715) at eu.extech.serverImpl.jdo.JDOConnection.persistenceManagerInit(JDOConnection.java:384) Caused by: java.lang.ClassNotFoundException: javax.transaction.Synchronization at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499) ... 35 more
So a searched for this class in Eclipse and found it only in objectdb.jar, not anymore in JRE (using Java SE 10.0.1). So I tried to track down why it is not found via runtime and discovered that within the method jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(String cn, boolean resolve) there is found a LoadedModule with this footprint
[module java.transaction, location=jrt:/java.transaction]
and within this module the Synchronization class was not found.
If I am not mistaken this module comes from the JRE and not from objectdb.jar, so I thought that's why objectdb.jar is not searched at all for it.
I tried then adding this command line argument to make the JVM search it in objectdb.jar
--patch-module java.transaction=lib/objectdb.jar
But with that the JVM did not start at all and threw the following error
Error occurred during initialization of boot layer java.lang.LayerInstantiationException: Package javax.transaction.xa in both module java.transaction and module java.sql Could you please advice me how to make my app locate this class ?
Regards,
Gergely