1

我的 maven 项目的构建是一场战争,其中包含 spring-data-commons-1.13.4.RELEASE.jar、hibernate-jpa-2.1-api-1.0.0.Final.jar、hibernate-entitymanager-5.0.12.Final .jar 等

我已经在 tomee.xml 中配置了数据源,下面给出了 persistence.xml 的相关片段:

 <persistence-unit name="PU_JTA"  transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>  
    <jta-data-source>java:/comp/env/jdbc/myDS</jta-data-source>  
    <mapping-file>META-INF/orm.xml</mapping-file>
    <properties>
        ...
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle12cDialect" />

默认情况下,Tomee 使用内置的 EclipseLink 并抛出以下内容:

[EclipseLink-25008] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description: A descriptor with default root element {http://java.sun.com/xml/ns/persistence/orm}entity-mappings was not found in the project 

当我从 tomee/libs 中删除 eclipselink-2.6.3.jar 时,

[localhost-startStop-1] org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate PersistenceUnit(name=merchantEdgePU_JTA, provider=org.eclipse.persistence.jpa.PersistenceProvider) - provider time 1ms
09-Oct-2017 18:19:10.027 SEVERE [localhost-startStop-1] org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal Error merging Java EE JNDI entries in to war /merchantEdgeREST: Exception: java.lang.ClassNotFoundException: org.eclipse.persistence.jpa.PersistenceProvider
org.apache.openejb.OpenEJBRuntimeException: java.lang.ClassNotFoundException: org.eclipse.persistence.jpa.PersistenceProvider 

大多数像this OR this的引用都建议“加载所有Hibernate jars和依赖项......在tomee / libs文件夹中”。

是否可以使用我部署到 apache -tomee-plume -7.0.3 的战争中的 hibernate 和 spring (jpa) jar 覆盖默认配置?

4

0 回答 0