Я только что закончил разработку приложения javafx, используя jdk 11 и EclipseLink 2.5.2 для ORM в IDE eclipse. Моя проблема сейчас в том, что jar, сгенерированный eclipse, продолжает падать, а в журналах говорится, что он не может найти файл постоянства. xml. Тем не менее, проект хорошо работает внутри IDE. Ниже приведен след исключений, генерируемых файлом jar.
Exception in thread "JavaFX Application Thread" java.lang.ExceptionInInitializerError
at graphics.controllers.orders.NewCommandController.loadBoxes(NewCommandController.java:328)
at graphics.controllers.orders.NewCommandController.access$1(NewCommandController.java:327)
at graphics.controllers.orders.NewCommandController$2.run(NewCommandController.java:309)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: Exception [EclipseLink-30009] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while trying to load persistence unit at url: rsrc:../
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: rsrc:../
Internal Exception: java.net.MalformedURLException
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionLoadingFromUrl(PersistenceUnitLoadingException.java:100)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:597)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:481)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchive(JPAInitializer.java:172)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchives(JPAInitializer.java:154)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfo(JPAInitializer.java:135)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:177)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at providers.DBProvider.<clinit>(DBProvider.java:18)
... 10 more
Caused by: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: rsrc:../
Internal Exception: java.net.MalformedURLException
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionProcessingPersistenceXML(PersistenceUnitLoadingException.java:118)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:638)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:595)
... 17 more
Caused by: java.net.MalformedURLException
at java.base/java.net.URL.<init>(URL.java:679)
at java.base/java.net.URL.<init>(URL.java:541)
at java.base/java.net.URL.<init>(URL.java:488)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:649)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:150)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:860)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:636)
... 18 more
Caused by: java.lang.NullPointerException
at java.base/java.net.URL.<init>(URL.java:585)
... 28 more
Это содержимое моей персистентности. xml file
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="ManuFastFood" transaction-type="RESOURCE_LOCAL">
<provider> org.eclipse.persistence.jpa.PersistenceProvider </provider>
<class>models.MenuType</class>
<class>models.MenuGroup</class>
<class>models.Element</class>
<class>models.HouseTable</class>
<class>models.Person</class>
<class>models.Command</class>
<class>models.CommandElement</class>
<class>models.Formula</class>
<class>models.UserConnection</class>
<properties>
<property name="javax.persistence.schema-generation.database.action" value="create"/>
<property name="javax.persistence.schema-generation.scripts.action" value="none"/>
<property name="javax.persistence.schema-generation.drop-source" value="metadata"/>
</properties>
</persistence-unit>
</persistence>
Затем я создаю свою сущность. manager
Properties values = getDBConfig();
HashMap<String,String> jpa = new HashMap<>();
jpa.put("javax.persistence.jdbc.url", "jdbc:mysql://"+values.getProperty(Constants.Keys.URL)+"/"
+values.getProperty(Constants.Keys.NAME)+"?serverTimezone=UTC&requireSSL=true");
jpa.put("javax.persistence.jdbc.user", values.getProperty(Constants.Keys.USER));
jpa.put("javax.persistence.jdbc.password", values.getProperty(Constants.Keys.PASSWORD));
EntityManagerFactory factory =Persistence.createEntityManagerFactory("ManuFastFood",jpa);
manager = factory.createEntityManager();
Я пробовал несколько предложений на этом сайте, но они, похоже, не работают для меня. Я попытался создать файл манифеста с определенной конфигурацией, как предложено в одном из сообщений, но файл заменяется каждый раз. Я не знаю, что еще попробовать.
jar, который я экспортирую из eclipse, выполняется путем упаковки необходимых библиотек в jar.