使用Hibernate配置TomEE

时间:2018-04-05 17:30:36

标签: java hibernate tomcat jpa tomee

我正在尝试使用Hibernate配置Tomee。

到目前为止我所做的更改:

在tomcat / lib文件夹中复制以下jar:

 antlr-2.7.7.jar
  dom4j-1.6.1.jar
  hibernate-entitymanager-4.0.1.Final.jar
  hibernate-annotations-3.4.0.GA.jar
  hibernate-commons-annotations.jar
  hibernate-core-3.3.2.GA.jar
  hibernate-jpa-2.0-api-1.0.1.Final.jar
  hibernate-validator-6.0.9.Final.jar
  hibernate-validator-annotation-processor-6.0.9.Final.jar
  hibernate-validator-cdi-6.0.9.Final.jar
  javassist-3.15.0-GA.jar
  jboss-logging-3.1.0.GA.jar

从tomcat / lib中删除了以下jar:

bval-core-0.5.jar
bval-jsr303-0.5.jar
commons-lang-2.6.jar
openjpa-2.4.0.jar
serp-1.14.1.jar

persistence.xml 如下所示:

<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
    <persistence-unit name="JPADB" > 
     <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>*****</jta-data-source>
        <properties> 
            <property name="hibernate.show_sql" value="false" />
            <property name="hibernate.format_sql" value="false" />
        </properties>
    </persistence-unit>
</persistence>

当我运行tomcat时,我遇到以下异常:

 org.apache.openejb.OpenEJBRuntimeException: java.lang.ClassNotFoundException: org.apache.openjpa.persistence.PersistenceProviderImpl: java.lang.ClassNotFoundException: org.apache.openjpa.persistence.PersistenceProviderImpl
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:843)
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:677)
    at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:568)
    at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:464)
    at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:151)
    at org.apache.openejb.OpenEJB.init(OpenEJB.java:309)
    at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:256)
    at org.apache.tomee.catalina.ServerListener.install(ServerListener.java:167)
    at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:54)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:394)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:642)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:667)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:253)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:427)
Caused by: org.apache.openejb.OpenEJBException: org.apache.openejb.OpenEJBRuntimeException: java.lang.ClassNotFoundException: org.apache.openjpa.persistence.PersistenceProviderImpl: java.lang.ClassNotFoundException: org.apache.openjpa.persistence.PersistenceProviderImpl
    at org.apache.openejb.assembler.classic.Assembler.loadPersistenceUnits(Assembler.java:988)
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:741)
    ... 20 more

我应该做些什么来改变hibernate?

0 个答案:

没有答案