jacoco-maven-plugin arquillian-persistence-dbunit ClassNotFound
snovawinter May 30, 2018 7:40 AMHi all.
I got a problem with arquillian after adding jacoco-maven-plugin in my pom:
Find_ShouldNotFind(ru.mos.eirc.w.ssm.server.repository.common.CountryRepositoryTest) Time elapsed: 0.022 sec <<< ERROR! org.jboss.arquillian.persistence.core.exception.PersistenceExtensionInitializationException: Unable to load Arquillian properties in container. Missing file arquillian.extension.persistence.properties at org.jboss.arquillian.persistence.core.configuration.ConfigurationImporter.loadFromPropertyFile(ConfigurationImporter.java:80) at org.jboss.arquillian.persistence.core.container.PersistenceConfigurationRemoteProducer.configure(PersistenceConfigurationRemoteProducer.java:44) 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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86) at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:105) at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:62) at org.jboss.arquillian.persistence.core.lifecycle.PersistenceTestTrigger.beforeClass(PersistenceTestTrigger.java:99) 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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86) at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90) at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:69) at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95) at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:83) at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:105) at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:89) at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:163) at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:350) at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54) at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:177) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:115) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:61) at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:139) at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:117) at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:86) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1692) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:258) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:654) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:593) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:159) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238) at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:483) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573) at java.lang.Thread.run(Thread.java:745) Caused by: org.jboss.arquillian.persistence.core.exception.PersistenceExtensionInitializationException: Unable to create persistence configuration. at org.jboss.arquillian.persistence.core.configuration.ConfigurationImporter.createConfiguration(ConfigurationImporter.java:158) at org.jboss.arquillian.persistence.core.configuration.ConfigurationImporter.createFrom(ConfigurationImporter.java:101) at org.jboss.arquillian.persistence.core.configuration.ConfigurationImporter.loadFromPropertyFile(ConfigurationImporter.java:76) ... 76 more Caused by: java.lang.IllegalArgumentException: Unable to convert value [[Z@43487352] to a class [[Z]. at org.jboss.arquillian.persistence.core.configuration.ConfigurationTypeConverter.convert(ConfigurationTypeConverter.java:194) at org.jboss.arquillian.persistence.core.configuration.ConfigurationImporter.createConfiguration(ConfigurationImporter.java:149) ... 78 more Caused by: java.lang.ClassNotFoundException: [Z@43487352 at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at org.jboss.arquillian.persistence.core.configuration.ConfigurationTypeConverter.convert(ConfigurationTypeConverter.java:189) ... 79 more
Arquillian dependencies:
org.jboss.arquillian arquillian-bom 1.4.0.Final import pom
org.jboss.arquillian.junit arquillian-junit-container test org.jboss.arquillian.container arquillian-glassfish-embedded-3.1 1.0.1 test fish.payara.extras payara-embedded-all 4.1.2.181 test org.jboss.arquillian.extension arquillian-persistence-dbunit 1.0.0.Alpha7 test
jococo-maven-plugin
org.jacoco jacoco-maven-plugin 0.8.1 false BUNDLE INSTRUCTION COVEREDRATIO 0.80 CLASS MISSEDCOUNT 0 prepare-agent prepare-agent check report
arquillian.xml
${basedir}/src/test/resources/glassfish-resources.xml
glassfish-resources.xml
persistence.xml
org.hibernate.jpa.HibernatePersistenceProvider jdbc/ssm ru.mos.eirc.jpa.entities.w.ssm.Country
@RunWith(Arquillian.class) @Transactionalpublic class CountryRepositoryTest { @Inject private CountryRepository countryRepository; @Deployment public static JavaArchive createDeployment() { JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") .addAsManifestResource("META-INF/persistence.xml", "persistence.xml") .addPackages(true, Repository.class.getPackage(), RepositoryFactory.class.getPackage()); System.out.println(javaArchive.toString(true)); return javaArchive; } @Test @UsingDataSet("datasets/country.yml") @Cleanup(strategy = CleanupStrategy.USED_ROWS_ONLY) public void Find_ShouldFind() { Country country = countryRepository.find(1000); Assert.assertNotNull(country); } }
This exception appears in embedded glassfish log in unit test-time execution. Test fails. Maven phase clean package.
It happens only if I add both dependencies: jacoco-maven-plugin and arquillian-persistence-dbunit. If only jacoco-maven-plugin added without arquillian-persistence-dbunit or arquillian-persistence-dbunit added without jacoco-maven-plugin test works fine.
Thank you!