0
Hello,
I am developing a simple CRUD study using Javafx such as GUI and JPA/Hibernate to do the work with the database. It’s a Maven project, I’ve added the required libraries and Javafx and Hibernate work on their own, but together they don’t work. To use Javafx, you must declare that I need this module in the module-info.java, but once I add this file to the project, the Intellij IDE requires that java.persistence is also required within that module. And done this, Hibernate no longer accesses the database with the following error:
***Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/SQLException at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:468) at [email protected]/org.jboss.logging.Logger.doGetMessageLogger(Logger.java:2562) at [email protected]/org.jboss.logging.Logger.getMessageLogger(Logger.java:2530) at [email protected]/org.jboss.logging.Logger.getMessageLogger(Logger.java:2516) at [email protected]/org.hibernate.internal.HEMLogging.messageLogger(HEMLogging.java:28) at [email protected]/org.hibernate.internal.HEMLogging.messageLogger(HEMLogging.java:24) at [email protected]/org.hibernate.jpa.boot.internal.PersistenceXmlParser.<clinit>(PersistenceXmlParser.java:54) at [email protected]/org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:81) at [email protected]/org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:61) at [email protected]/org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:50) at [email protected]/javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79) at [email protected]/javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54) at mySales/mysales.Main.main(Main.java:11) Caused by: java.lang.ClassNotFoundException: java.sql.SQLException at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ... 14 more***
I don’t even need to add Javafx to stop working, I just add java.persistence to the module-info.java and it doesn’t work anymore.
module mySales {
requires java.persistence;
}
Any suggestions or help to get these two frameworks to work together?