Problem running an Arquillian Test on a WildFly 8.1 Server using wildfly-arquillian-container-remote
thomas_schindler Feb 1, 2016 9:44 AMHi,
I have problems running Arquillian Tests for our J2EE backend system running on a WildFly 8.1.0.Final server using the wildfly-arquillian-container-remote. We are using a gradle build environment with a multi module build. The relevant gradle file for my build is this:
/*
* Copyright by EMPIC GmbH
* Werner-von-Siemens Strasse 61
* 91052 Erlangen
* Germany
* All rights reserved.
*/
ext.libraryVersions = [
javaee : '7.0',
wildfly : '8.1.0.Final',
junit : '4.11',
arquillian : '1.1.11.Final',
shrinkWrapResolver : '2.2.1',
arquillian_persistence : '1.0.0.Alpha7'
]
repositories {
maven { url 'https://repository.jboss.org/nexus/content/groups/public-jboss' }
maven { url 'https://repository.jboss.org/nexus/content/repositories' }
maven { url 'https://repository.jboss.org/nexus/content/repositories/thirdparty-releases' }
maven { url 'http://repo.gradle.org/gradle/libs-releases/' }
mavenCentral()
}
dependencies {
// configure the dependencies for the shared.jar
sharedCompile project(path: ':empic-core', configuration: 'sharedCompile')
sharedRuntime project(path: ':empic-core', configuration: 'sharedRuntime')
sharedCompile project(path: ':central-suite', configuration: 'sharedCompile')
sharedServerCompile project(path: ':empic-core', configuration: 'sharedServerCompile')
sharedServerCompile project(path: ':central-suite', configuration: 'sharedServerCompile')
webCompile(project(path: ':mod-showcase', configuration: 'sharedCompile')) { transitive = false }
// configure the dependencies for the gui.jar
guiCompile project(path: ':central-suite', configuration: 'guiCompile')
guiCompile project(path: ':security-core', configuration: 'guiCompile')
guiCompile project(path: ':empic-core', configuration: 'guiCompile')
testCompile "org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-bom:${libraryVersions.shrinkWrapResolver}"
testCompile "org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-depchain:${libraryVersions.shrinkWrapResolver}"
testCompile "org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-gradle-depchain:${libraryVersions.shrinkWrapResolver}"
testCompile "org.jboss.arquillian:arquillian-bom:${libraryVersions.arquillian}"
testCompile "org.jboss.arquillian.junit:arquillian-junit-container:${libraryVersions.arquillian}"
testCompile "org.wildfly:wildfly-arquillian-container-remote:${libraryVersions.wildfly}"
test {
/**
* Installation of JBOSS to use for testing, this can be set here
* or in the arquillian.xml.
environment 'JBOSS_HOME', jbossHome
*/
environment 'jbossHome', 'D:/programme/empic-server'
/**
* WildFly embedded default logging
*/
systemProperty 'java.util.logging.manager', 'org.jboss.logmanager.LogManager'
systemProperty 'jboss.server.default.config', 'standalone-full.xml'
systemProperty 'modulePath', 'D:/programme/empic-server/modules'
}
}
In my deployment method I use the ear which contains the code to be tested, create an EnterpriseArchive from it, add the test.jar, wich contains my test class. I additionally remove the included war modules - which I don't need for the tests:
@RunWith(Arquillian.class)
public class TestShowCaseManagement
{
@Deployment
public static Archive<?> createDeployment() throws URISyntaxException
{
EnterpriseArchive eapEar = ShrinkWrap.createFromZipFile(EnterpriseArchive.class, new File(new File(".."), "/eap-ear/build/libs/empic-2016R1.ear"));
JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "test.jar");
testJar.addClass(TestShowCaseManagement.class).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
testJar.addAsResource(new File(new File(".."), "/showcase/src/test/resources/de/empic/showcase/sb/arquillian.xml"));
System.out.println(testJar.toString());
eapEar.addAsLibrary(testJar);
adaptWarModules(eapEar);
addTestDependencies(eapEar);
File destinationDir = new File("d:/temp"); // Directory to which we'll export
eapEar.as(ExplodedExporter.class).exportExploded(destinationDir);
return eapEar;
}
My test finally simple calls a method in a stateless Enterprise Java Bean:
@EJB
private ShowcaseManagement scManagement;
@Before
public void beforeTest()
{
System.out.println("Before Test!");
}
@Test
public void test()
{
System.out.println("in Test");
scManagement.doQuery("123456", "123456");
fail("Not yet implemented");
}
Unforunately the test method is never called, because of the following error, I took the error from the gradle call of the test-Task:
15:18:17.427 [DEBUG] [TestEventLogger]
15:18:17.428 [DEBUG] [TestEventLogger] de.empic.showcase.sb.TestShowCaseManagement > test STARTED
15:18:17.462 [DEBUG] [TestEventLogger]
15:18:17.463 [DEBUG] [TestEventLogger] de.empic.showcase.sb.TestShowCaseManagement > test FAILED
15:18:17.464 [DEBUG] [TestEventLogger] java.lang.IncompatibleClassChangeError: Class org.jboss.logmanager.Logger does not implement the requested interface java.lang.reflect.InvocationHandler
15:18:17.464 [DEBUG] [TestEventLogger] at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java)
15:18:17.464 [DEBUG] [TestEventLogger] at org.jboss.arquillian.junit.Arquillian.access$300(Arquillian.java:54)
15:18:17.465 [DEBUG] [TestEventLogger] at org.jboss.arquillian.junit.Arquillian$6.runReflectiveCall(Arquillian.java:281)
15:18:17.465 [DEBUG] [TestEventLogger] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
15:18:17.465 [DEBUG] [TestEventLogger] at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:283)
15:18:17.465 [DEBUG] [TestEventLogger] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
15:18:17.466 [DEBUG] [TestEventLogger] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
15:18:17.466 [DEBUG] [TestEventLogger] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
15:18:17.466 [DEBUG] [TestEventLogger] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
15:18:17.466 [DEBUG] [TestEventLogger] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
15:18:17.466 [DEBUG] [TestEventLogger] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
15:18:17.467 [DEBUG] [TestEventLogger] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
15:18:17.467 [DEBUG] [TestEventLogger] at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:204)
15:18:17.467 [DEBUG] [TestEventLogger] at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:426)
15:18:17.467 [DEBUG] [TestEventLogger] at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54)
15:18:17.468 [DEBUG] [TestEventLogger] at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:218)
15:18:17.468 [DEBUG] [TestEventLogger] at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
15:18:17.468 [DEBUG] [TestEventLogger] at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:166)
15:18:17.468 [DEBUG] [TestEventLogger] at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
15:18:17.469 [DEBUG] [TestEventLogger] at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
15:18:17.469 [DEBUG] [TestEventLogger] at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
15:18:17.469 [DEBUG] [TestEventLogger] at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
15:18:17.469 [DEBUG] [TestEventLogger] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:18:17.470 [DEBUG] [TestEventLogger] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
15:18:17.470 [DEBUG] [TestEventLogger] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
15:18:17.470 [DEBUG] [TestEventLogger] at java.lang.reflect.Method.invoke(Method.java:498)
15:18:17.470 [DEBUG] [TestEventLogger] at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
15:18:17.470 [DEBUG] [TestEventLogger] at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
15:18:17.471 [DEBUG] [TestEventLogger] at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
15:18:17.471 [DEBUG] [TestEventLogger] at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
15:18:17.471 [DEBUG] [TestEventLogger] at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
15:18:17.471 [DEBUG] [TestEventLogger] at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
15:18:17.472 [DEBUG] [TestEventLogger] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:18:17.472 [DEBUG] [TestEventLogger] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
15:18:17.472 [DEBUG] [TestEventLogger] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
15:18:17.473 [DEBUG] [TestEventLogger] at java.lang.reflect.Method.invoke(Method.java:498)
15:18:17.473 [DEBUG] [TestEventLogger] at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
15:18:17.473 [DEBUG] [TestEventLogger] at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
15:18:17.473 [DEBUG] [TestEventLogger] at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355)
15:18:17.474 [DEBUG] [TestEventLogger] at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
15:18:17.474 [DEBUG] [TestEventLogger] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
15:18:17.474 [DEBUG] [TestEventLogger] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
15:18:17.475 [DEBUG] [TestEventLogger] at java.lang.Thread.run(Thread.java:745)
15:18:18.653 [DEBUG] [TestEventLogger]
15:18:18.654 [QUIET] [system.out] 15:18:18.653 [
15:18:18.654 [DEBUG] [TestEventLogger] de.empic.showcase.sb.TestShowCaseManagement FAILED
15:18:18.654 [QUIET] [system.out] INFO] [org.gradle.api.internal.tasks.testing.worker.TestWorker] Gradle Test Executor 1 finished executing tests.
I tried to run this test with an embedded wildfly container, with different JUnit versions, but always this error pops up and I don't have any idea, what the problem is. The ear which is deployed starts without any errors on the remote server.
Can anyone help?
Thomas