com.objectdb.o.InternalException: java.lang.NoClassDefFoundError: java/sql/Date

#1

I've seen this error in another thread, but there was no explanation for fixing the problem. I am using objectdb-2.8.7. Here is the stack trace.

Exception in thread "main" [ObjectDB 2.8.7] Unexpected exception (Error 990)
  Generated by OpenJDK 64-Bit Server VM 17.0.3 (on Mac OS X 12.6).
Please report this error on http://www.objectdb.com/issue/new
com.objectdb.o.InternalException: java.lang.NoClassDefFoundError: java/sql/Date
java.lang.NoClassDefFoundError: java/sql/Date
at objectdb/com.objectdb.o.VUT.<clinit>(VUT.java:68)
at objectdb/com.objectdb.o.RAT.l(RAT.java:106)
at objectdb/com.objectdb.o.RTT.g(RTT.java:136)
at objectdb/com.objectdb.o.TSK.b(TSK.java:146)
at objectdb/com.objectdb.o.TSK.c(TSK.java:96)
at objectdb/com.objectdb.o.MST.at(MST.java:758)
at objectdb/com.objectdb.o.MST.am(MST.java:259)
at objectdb/com.objectdb.o.MST.<init>(MST.java:131)
at objectdb/com.objectdb.o.MST.ap(MST.java:109)
at objectdb/com.objectdb.o.MSF.YQ(MSF.java:190)
at objectdb/com.objectdb.o.OMF.s(OMF.java:805)
at objectdb/com.objectdb.jpa.EMF.s(EMF.java:130)
at objectdb/com.objectdb.o.OMF.x(OMF.java:716)
at objectdb/com.objectdb.jpa.EMF.createEntityManager(EMF.java:149)
at ObjectDBTest/javaobjectdbapp.JavaObjectDBApp.main(JavaObjectDBApp.java:14)
Caused by: java.lang.ClassNotFoundException: java.sql.Date
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 15 more

 

I'm following this tutorial.

https://www.developer.com/database/using-objectdb-in-java-projects/

the mainifest-info.java is ...

module ObjectDBTest {

requires objectdb;

}

This is perplexing because java.sql.Date comes with the JDK. I'm stumped.

#2

See a workaround on https://bugs.openjdk.org/browse/JDK-8262105.

If you can provide exact details how to reproduce the exception (including version of Java, version of ObjectDB, other used tools, code, step by step instructions), we may be able to provide a better solution.

ObjectDB Support
#3

My bad.

I attached the two Java classes and the module-info file. The classes go into a javaobjectdbapp package. I am using JRE 17.0.3, and the version of objectdb is 2.8.7. ObjectDB is the only referenced library. I ran the project in eclipse version 2022-09 (4.25.0). Then, I opened the project in Netbeans 15 and was able to recreate the problem.

Thanks.

 

#4

You will have to add ObjectDB to the classpath rather than as a module, as the current version of ObjectDB depends on JPA and JDO jar files with no Java 9 module support.

Your example works fine in Eclipse if ObjectDB is added to the classpath:

(Mickey Mouse, Disney)
(Donald Duck, Disney)
(Hulk, Marvel)
(Spiderman, Marvel)
(Superman, DC)

ObjectDB Support
#5

After I moved the compiler back to 1.8, deleted module-info.java, and put objectdb on the classpath, the application worked. Thanks for your help. One last question: Can this application work when using Java 9 or greater? I couldn't get it to work using Java 17.

#6

Sure, you should be able to use Java 17 and actually the output in #4 above is from Java 17.

ObjectDB Support
#7

I got it to work using Java 17. Thanks again.

 

Reply