Jboss Arquillian to tests with Jboss 4.2.3 GA
carloslimasis Jul 30, 2018 1:56 PMHi guys!
I've tried adding the test configuration for my project and I need to use the JBoss 4.2.3 GA in my tests.
In my pom.xml I have:
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.jboss.arquillian</groupId>
- <artifactId>arquillian-bom</artifactId>
- <version>1.4.0.Final</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
- </dependencies>
- </dependencyManagement>
...
- <dependency>
- <groupId>org.jboss.arquillian.junit</groupId>
- <artifactId>arquillian-junit-container</artifactId>
- <scope>test</scope>
- </dependency>
...
And the profile:
- <profiles>
- <profile>
- <id>arquillian-jbossas-managed</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.jboss.spec</groupId>
- <artifactId>jboss-javaee-6.0</artifactId>
- <version>1.0.0.Final</version>
- <type>pom</type>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.client</groupId>
- <artifactId>jbossall-client</artifactId>
- <version>4.2.3.GA</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-server-manager</artifactId>
- <version>1.0.3.GA</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.container</groupId>
- <artifactId>arquillian-jbossas-managed-4.2</artifactId>
- <version>1.0.0.CR3</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-servlet</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>process-test-classes</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-dist</artifactId>
- <version>4.2.3.GA</version>
- <type>zip</type>
- <overWrite>false</overWrite>
- <outputDirectory>target</outputDirectory>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
And an arquillian.xml too:
- <?xml version="1.0" encoding="UTF-8"?>
- <arquillian xmlns="http://jboss.org/schema/arquillian"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://jboss.org/schema/arquillian
- http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
- <container qualifier="jbossas-managed" default="true">
- <configuration>
- <!-- If you want to use an existing JBoss AS installation, change the value of this property to that path -->
- <!-- If you've already set the JBOSS_HOME environment variable, you can remove this configuration block -->
- <property name="jbossHome">target/jboss-4.2.3.GA</property>
- </configuration>
- </container>
- </arquillian>
Then, when I try to run the tests I have the following error:
- Connected to the target VM, address: '127.0.0.1:58687', transport: 'socket'
- 26/07/2018 11:49:26 org.jboss.arquillian.container.impl.MapObject populate
- AVISO: Configuration contain properties not supported by the backing object org.jboss.arquillian.container.jbossas.managed_4_2.JBossASConfiguration
- Unused property entries: {outputToConsole=true}
- Supported property names: [shutdownTimeoutInSeconds, javaVmArguments, javaHome, partition, jbossHome, bindAddress, urlPkgPrefix, httpPort, startupTimeoutInSeconds, useRmiPortForAliveCheck, profileName, rmiPort]
- Starting server "default", with command (start timeout is 120 seconds ):
- C:\Program Files (x86)\Java\jdk1.6.0_45\bin\java -cp C:\Users\carlos.lima\Development\persi\target\jboss-4.2.3.GA\bin\run.jar;C:\Program Files (x86)\Java\jdk1.6.0_45\lib\tools.jar -Xmx512m -XX:MaxPermSize=128m -Djbosstest.udp.ip_ttl=0 -Djava.endorsed.dirs=C:\Users\carlos.lima\Development\persi\target\jboss-4.2.3.GA\lib\endorsed -Djboss.server.log.threshold=DEBUG -Djava.endorsed.dirs=C:\Users\carlos.lima\Development\persi\target\jboss-4.2.3.GA/lib/endorsed/ -Dxb.builder.useUnorderedSequence=true org.jboss.Main -c default -b localhost -g 164d710e8b7
- org.jboss.arquillian.container.spi.client.container.LifecycleException: Could not connect to container
- at org.jboss.arquillian.container.jbossas.managed_4_2.JBossASLocalContainer.start(JBossASLocalContainer.java:116)
- at org.jboss.arquillian.container.impl.ContainerImpl.start(ContainerImpl.java:199)
- at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:163)
- at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:157)
- at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:255)
- at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startContainer(ContainerLifecycleController.java:156)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
- at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
- at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
- at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
- at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
- at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
- at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
- at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
- at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:77)
- at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:70)
- at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forEachSuiteContainer(ContainerLifecycleController.java:221)
- at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startSuiteContainers(ContainerLifecycleController.java:69)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
- at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
- at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
- at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
- at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
- at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
- at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:86)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
- at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
- at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
- at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
- at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:92)
- at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
- at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
- at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:75)
- at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:116)
- at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
- at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
- at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
- at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
- at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
- Caused by: java.io.IOException: Cannot run program "C:\Program" (in directory "C:\Users\carlos.lima\Development\persi\target\jboss-4.2.3.GA\bin"): CreateProcess error=2, O sistema não pode encontrar o arquivo especificado
- at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
- at java.lang.Runtime.exec(Runtime.java:593)
- at java.lang.Runtime.exec(Runtime.java:431)
- at org.jboss.jbossas.servermanager.ServerController.startServer(ServerController.java:106)
- at org.jboss.jbossas.servermanager.ServerManager.startServer(ServerManager.java:163)
- at org.jboss.arquillian.container.jbossas.managed_4_2.JBossASLocalContainer.start(JBossASLocalContainer.java:109)
- ... 60 more
- Caused by: java.io.IOException: CreateProcess error=2, O sistema não pode encontrar o arquivo especificado
- at java.lang.ProcessImpl.create(Native Method)
- at java.lang.ProcessImpl.<init>(ProcessImpl.java:177)
- at java.lang.ProcessImpl.start(ProcessImpl.java:28)
- at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
- ... 65 more
- Test ignored.
- Disconnected from the target VM, address: '127.0.0.1:58687', transport: 'socket'
- Process finished with exit code -1
Can someone help me?
Hi guys! Apparently, the problem is when Arquillian executes the method startServer of ServerController class of jboss-server-manager dependency. In resume, if my javaHome contains white spaces it's a problem.
Ok, I resolved this problem for now, but, I came across with other problem:
Caused by: javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException: No deployment manager for uri=jnp://localhost:1099 at javax.enterprise.deploy.shared.factories.DeploymentFactoryManager.getDeploymentManager(DeploymentFactoryManager.java:120) at org.jboss.arquillian.container.jbossas.managed_4_2.JBossASLocalContainer.createDeploymentManager(JBossASLocalContainer.java:264) at org.jboss.arquillian.container.jbossas.managed_4_2.JBossASLocalContainer.start(JBossASLocalContainer.java:112)
So, guys, I resolved this problem too.
For this I removed the following dependency:
dom4j dom4j 1.6.1 provided
and added the dependency:
org.jboss.spec jboss-javaee-6.0 1.0.0.Final pom provided
but, I came across with other problem:
java.lang.RuntimeException: cannot obtain module type at org.jboss.deployment.spi.DeploymentManagerImpl.createDeployment(DeploymentManagerImpl.java:491) at org.jboss.deployment.spi.DeploymentManagerImpl.distribute(DeploymentManagerImpl.java:350) at org.jboss.deployment.spi.DeploymentManagerImpl.distribute(DeploymentManagerImpl.java:316) at org.jboss.arquillian.container.jbossas.managed_4_2.JBossASLocalContainer.deploy(JBossASLocalContainer.java:168) at org.jboss.arquillian.container.jbossas.managed_4_2.JBossASLocalContainer.deploy(JBossASLocalContainer.java:136) at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:151) at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:118) at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:239) at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:71) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:54) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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.container.impl.client.container.DeploymentExceptionHandler.verifyExpectedExceptionDuringDeploy(DeploymentExceptionHandler.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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.core.impl.EventImpl.fire(EventImpl.java:62) at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:92) at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:77) at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.java:232) at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment(ContainerDeployController.java:212) at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployController.java:77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:96) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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.createClassContext(TestContextHandler.java:83) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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.createSuiteContext(TestContextHandler.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) 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 com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
I created my deployment archive this way:
- @Deployment
- public static Archive createDeployment() {
- final JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class, "test.jar")
- .addPackages(Boolean.TRUE, "mypackage")
- .addAsManifestResource("META-INF/ejb-jar.xml", "ejb-jar.xml")
- .addAsManifestResource("META-INF/persistence.xml", "persistence.xml")
- .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
- System.out.println(javaArchive.toString(true));
- return javaArchive;
- }