У меня есть проект JPA, который правильно работает в Eclipse, но когда я пытаюсь экспортировать исполняемый файл jar и запустить его из cmd, он выдает это исключение.
У меня есть 2 единицы постоянства в проекте, кажется, что вторая не распознается.
Первое исключение, похоже, вызвано ошибкой ниже
"Отсутствует поставщик сохраняемости для EntityManager с именем Mongo_PU "
Примечание :" Mongo_PU "присутствует в файле persistence.xml.Это определяется следующим образом:
<persistence-unit name="Mongo_PU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<class>com.jpa.GridListEvent</class>
<class>com.jpa.HybridListEventBody</class>
<class>com.jpa.HybridSimpleEventBody</class>
<class>com.jpa.MongoSimpleEvent</class>
<class>com.jpa.RefListEvent</class>
<class>com.jpa.RowElementEntity</class>
<class>com.jpa.RowReceiptEntity</class>
<class>com.jpa.OgmSimpleEvent</class>
<class>com.jpa.OgmSimpleEventBody</class>
<!-- <exclude-unlisted-classes>false</exclude-unlisted-classes>-->
<properties>
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform" />
<property name="com.arjuna.ats.jta.jtaTMImplementation"
value="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple" />
<property name="com.arjuna.ats.jta.jtaUTImplementation"
value="com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple" />
<property name="hibernate.ogm.datastore.create_database"
value="true" />
<property name="hibernate.ogm.datastore.provider"
value="mongodb" />
<property name="hibernate.ogm.datastore.database"
value="ActingMongo" />
<property name="hibernate.ogm.mongodb.host"
value="127.0.0.1" />
<property name="hibernate.ogm.mongodb.port" value="27017" />
</properties>
</persistence-unit>
Это полная трассировка стека
javax.persistence.PersistenceException: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [MySQL_PU] failed. Close all factories for this PersistenceUnit.
Internal Exception: java.lang.ExceptionInInitializerError
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createDeployFailedPersistenceException(EntityManagerSetupImpl.java:820)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:760)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:204)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:304)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:336)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:302)
at it.mypackage.ejb.AbstractDataManager.getEntityManager(AbstractDataManager.java:1145)
at com.actor.benchmark.Janitor.run(Janitor.java:131)
at com.actor.benchmark.hybridpersistence.OgmListInsert.main(OgmListInsert.java:42)
Caused by: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [MySQL_PU] failed. Close all factories for this PersistenceUnit.
Internal Exception: java.lang.ExceptionInInitializerError
at org.eclipse.persistence.exceptions.EntityManagerSetupException.deployFailed(EntityManagerSetupException.java:238)
... 9 more
Caused by: java.lang.ExceptionInInitializerError
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:374)
at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(PrivilegedAccessHelper.java:124)
at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityListenerMetadata.getClass(EntityListenerMetadata.java:224)
at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityClassListenerMetadata.process(EntityClassListenerMetadata.java:81)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processListeners(EntityAccessor.java:1220)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.addEntityListeners(MetadataProcessor.java:138)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:591)
... 7 more
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named Mongo_PU
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:85)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at it.mypackage.ejb.AbstractDataManager.getFactory(AbstractDataManager.java:100)
at com.actor.jpa.HybridSimpleEvent.<clinit>(HybridSimpleEvent.java:42)
... 15 more
Datasources cleared:522ms [OgmSimpleEvent, OgmSimpleEventBody, JaxListEvent, OgmListEvent, OgmListEventBody, OgmHopListEvent, OgmBigSimpleEvent, OgmBigSimpleEventBody, OgmBigListEvent, OgmBigListEventBody, RotationClass, HybridBigEvent, JaxListEvent, PolyEvent]
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
feb 01, 2019 12:36:20 AM it.mypackage.ejb.Bloomy setupMessanger
INFORMAZIONI: Loading messanger it.mypackage.ejb.DefaultMessanger
local bloomy core
javax.persistence.PersistenceException: Exception [EclipseLink-28013] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Unable to deploy PersistenceUnit [MySQL_PU] in invalid state [DeployFailed].
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [MySQL_PU] failed. Close all factories for this PersistenceUnit.
Internal Exception: java.lang.ExceptionInInitializerError
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:547)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:204)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:304)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:336)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:302)
at it.mypackage.ejb.AbstractDataManager.getEntityManager(AbstractDataManager.java:1145)
at com.actor.benchmark.hybridpersistence.OgmListInsert.main(OgmListInsert.java:70)
Caused by: Exception [EclipseLink-28013] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Unable to deploy PersistenceUnit [MySQL_PU] in invalid state [DeployFailed].
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [MySQL_PU] failed. Close all factories for this PersistenceUnit.
Internal Exception: java.lang.ExceptionInInitializerError
at org.eclipse.persistence.exceptions.EntityManagerSetupException.cannotDeployWithoutPredeploy(EntityManagerSetupException.java:190)
... 7 more
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [MySQL_PU] failed. Close all factories for this PersistenceUnit.
Internal Exception: java.lang.ExceptionInInitializerError
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createDeployFailedPersistenceException(EntityManagerSetupImpl.java:820)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:760)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:204)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:304)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:336)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:302)
at it.mypackage.ejb.AbstractDataManager.getEntityManager(AbstractDataManager.java:1145)
at com.actor.benchmark.Janitor.run(Janitor.java:131)
at com.actor.benchmark.hybridpersistence.OgmListInsert.main(OgmListInsert.java:42)
Caused by: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [MySQL_PU] failed. Close all factories for this PersistenceUnit.
Internal Exception: java.lang.ExceptionInInitializerError
at org.eclipse.persistence.exceptions.EntityManagerSetupException.deployFailed(EntityManagerSetupException.java:238)
... 9 more
Caused by: java.lang.ExceptionInInitializerError
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:374)
at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(PrivilegedAccessHelper.java:124)
at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityListenerMetadata.getClass(EntityListenerMetadata.java:224)
at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityClassListenerMetadata.process(EntityClassListenerMetadata.java:81)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processListeners(EntityAccessor.java:1220)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.addEntityListeners(MetadataProcessor.java:138)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:591)
... 7 more
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named Mongo_PU
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:85)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at it.mypackage.ejb.AbstractDataManager.getFactory(AbstractDataManager.java:100)
at com.actor.jpa.HybridSimpleEvent.<clinit>(HybridSimpleEvent.java:42)
... 15 more
OgmListEvent [SIZE:10 TABLEA_SIZE:100 TABLEB_SIZE:100] 1ms