TomEE Arquillian额外的Hibernate测试库

时间:2019-01-01 15:40:15

标签: hibernate jpa integration-testing jboss-arquillian tomee

我正在尝试在TomEE 8中对JPA(休眠和Hikari)进行集成测试。

根据TomEE文档,我可以使用pom.xml(surefire插件)中的 additionalLibs 来添加其他库,我添加了如下所述的hibernate和Hikari依赖项。但是在开始测试用例时出错。

如何解决此问题?

<systemPropertyVariables>      
                <tomee.additionalLibs>
                    mvn:org.hibernate:hibernate-entitymanager:${hibernate.version}
                    mvn:org.hibernate:hibernate-hikaricp:${hibernate.version}

                    mvn:ch.qos.logback:logback-classic:${logback.version}
                    mvn:ch.qos.logback:logback-core:${logback.version}
                    mvn:org.slf4j:slf4j-api:${slf4j.version}
                </tomee.additionalLibs>
                </systemPropertyVariables>       



<dependency>
            <groupId>org.apache.tomee</groupId>
            <artifactId>arquillian-tomee-remote</artifactId>
            <version>${tomee.version}</version>
            <scope>test</scope>
</dependency>

例外:

Caused by: org.apache.openejb.OpenEJBException: org.apache.openejb.OpenEJBRuntimeException: java.lang.ClassNotFoundException: org.hibernate.jpa.HibernatePersistenceProvider: java.lang.ClassNotFoundException: org.hibernate.jpa.HibernatePersistenceProvider
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:926)
    ... 66 more
Caused by: org.apache.openejb.OpenEJBRuntimeException: java.lang.ClassNotFoundException: org.hibernate.jpa.HibernatePersistenceProvider
    at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:136)
    at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.<init>(ReloadableEntityManagerFactory.java:105)
    at org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:157)
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:920)
    ... 66 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.jpa.HibernatePersistenceProvider
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)
    at org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:208)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1138)
    at org.apache.openejb.assembler.classic.EntityManagerFactoryCallable.call(EntityManagerFactoryCallable.java:84)
    at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:134)
    ... 69 more

0 个答案:

没有答案