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