TomEE arquillian additional library for Hibernate in Testing

孤街浪徒 提交于 2019-12-25 03:44:15

问题


I am trying to do integration testing for JPA ( hibernate and Hikari ) in TomEE 8.

As per TomEE documentation I can additional libraries using additionalLibs in pom.xml ( surefire pluggin) , I have added hibernate and Hikari dependencies as mentioned below . But getting error while starting my test case.

How to fix this issue ?

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

Exception:

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

来源:https://stackoverflow.com/questions/53996746/tomee-arquillian-additional-library-for-hibernate-in-testing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!