Spring中的数据JPA + Hibernate在Tomee中

时间:2017-10-09 13:00:06

标签: spring hibernate jpa apache-tomee tomee-7

我的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 

大多数引用如thisthis建议在#me; / libs文件夹中加载所有Hibernate jar和依赖...&#34;。

是否可以使用休眠&amp; spring(jpa)来自战争的罐子我已经部署到apache- tomee-plume -7.0.3覆盖默认配置?

0 个答案:

没有答案