4 Replies Latest reply on Sep 15, 2011 8:34 AM by Viggo Navarsete

    Problem using Jboss 6 remote and embedded container in Arquillian

    Viggo Navarsete Expert

      Hi,

       

      I've had one attempt a couple of months ago to get a simple test up and running on either a Jboss 6 remote or embedded server, but with no luck. I've tried again for two days now, but still not able to get the simple TemperatureConverter example to work! I've had issues with unable to connect to server, had to add a repository to deprecated dependencies, to use or not to use jndi.properties and arquillian.xml++...

      Can anyone give me a link to a tutorial that works, or a complete pom.xml file with everything that is need in order to make it work? I'm running Jboss 6.0.0.Final in production, and would as a first step like to use Jboss 6, either remote or embedded.

       

      Here is my current pom.xml that doesn't work:

       

       

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

               xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

          <modelVersion>4.0.0</modelVersion>

       

       

          <groupId>com.mycompany</groupId>

          <artifactId>ArquillianTestProject</artifactId>

          <version>1.0-SNAPSHOT</version>

          <packaging>war</packaging>

       

       

          <name>ArquillianTestProject</name>

       

       

          <properties>

              <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>

              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

              <arquillian.version>1.0.0.Alpha5</arquillian.version>

          </properties>

       

       

          <dependencies>

              <dependency>

                  <groupId>javax</groupId>

                  <artifactId>javaee-web-api</artifactId>

                  <version>6.0</version>

                  <scope>provided</scope>

              </dependency>

       

       

              <dependency>

                  <groupId>javax.enterprise</groupId>

                  <artifactId>cdi-api</artifactId>

                  <version>1.0-SP1</version> 

              </dependency>

       

       

              <dependency>

                  <groupId>junit</groupId>

                  <artifactId>junit</artifactId>

                  <version>4.8.2</version>

                  <scope>test</scope>

              </dependency>

       

              <dependency>

                  <groupId>org.jboss.arquillian</groupId>

                  <artifactId>arquillian-junit</artifactId>

                  <version>${arquillian.version}</version>

                  <scope>test</scope>

              </dependency>       

          </dependencies>

       

       

          <build>

              <plugins>

                  <plugin>

                      <groupId>org.apache.maven.plugins</groupId>

                      <artifactId>maven-compiler-plugin</artifactId>

                      <version>2.3.2</version>

                      <configuration>

                          <source>1.6</source>

                          <target>1.6</target>

                          <compilerArguments>

                              <endorseddirs>${endorsed.dir}</endorseddirs>

                          </compilerArguments>

                      </configuration>

                  </plugin>

                  <plugin>

                      <groupId>org.apache.maven.plugins</groupId>

                      <artifactId>maven-war-plugin</artifactId>

                      <version>2.1.1</version>

                      <configuration>

                          <failOnMissingWebXml>false</failOnMissingWebXml>

                      </configuration>

                  </plugin>

                  <plugin>

                      <groupId>org.apache.maven.plugins</groupId>

                      <artifactId>maven-dependency-plugin</artifactId>

                      <version>2.1</version>

                      <executions>

                          <execution>

                              <phase>validate</phase>

                              <goals>

                                  <goal>copy</goal>

                              </goals>

                              <configuration>

                                  <outputDirectory>${endorsed.dir}</outputDirectory>

                                  <silent>true</silent>

                                  <artifactItems>

                                      <artifactItem>

                                          <groupId>javax</groupId>

                                          <artifactId>javaee-endorsed-api</artifactId>

                                          <version>6.0</version>

                                          <type>jar</type>

                                      </artifactItem>

                                  </artifactItems>

                              </configuration>

                          </execution>

                      </executions>

                  </plugin>

              </plugins>

          </build>

       

       

          <profiles>

              <profile>

                  <id>jbossas-remote-6</id>

                  <dependencies>

                      <dependency>

                          <groupId>org.jboss.arquillian.container</groupId>

                          <artifactId>arquillian-jbossas-remote-6</artifactId>

                          <version>${arquillian.version}</version>

                      </dependency>

                      <dependency>

                          <groupId>org.jboss.jbossas</groupId>

                          <artifactId>jboss-as-client</artifactId>

                          <version>6.0.0.Final</version>

                          <type>pom</type>

                      </dependency>

                  </dependencies>

              </profile>

       

              <profile>

                  <id>jbossas-embedded-6</id>

                  <dependencies>

                      <dependency>

                          <groupId>org.jboss.arquillian.container</groupId>

                          <artifactId>arquillian-jbossas-embedded-6</artifactId>

                          <version>1.0.0.Alpha5</version>

                      </dependency>

                      <dependency>

                          <groupId>org.jboss.jbossas</groupId>

                          <artifactId>jboss-as-depchain</artifactId>

                          <version>6.0.0.Final</version>

                          <type>pom</type>

                      </dependency>

                  </dependencies>

                  <dependencyManagement>

                      <dependencies>

                          <dependency>

                              <groupId>org.jboss.jbossas</groupId>

                              <artifactId>jboss-as-depchain</artifactId>

                              <version>6.0.0.Final</version>

                              <type>pom</type>

                              <scope>import</scope>

                          </dependency>

                      </dependencies>

                  </dependencyManagement>

                  <build>

                      <plugins>

                          <plugin>

                              <artifactId>maven-surefire-plugin</artifactId>

                              <configuration>

                                  <additionalClasspathElements>

                                      <additionalClasspathElement>${env.JBOSS_HOME}/client/jbossws-native-client.jar</additionalClasspathElement>

                              <!--

                                  Because jbossweb.sar contains shared web.xml, which must be

                                  visible from same CL as TomcatDeployer.class.getClassLoader

                              -->

                                      <additionalClasspathElement>${env.JBOSS_HOME}/server/default/deploy/jbossweb.sar</additionalClasspathElement>

                                  </additionalClasspathElements>

                                  <redirectTestOutputToFile>true</redirectTestOutputToFile>

                                  <trimStackTrace>false</trimStackTrace>

                                  <printSummary>true</printSummary>

                                  <forkMode>once</forkMode>

                          <!--

                              MaxPermSize Required to bump the space for relective data like

                              classes, methods, etc. EMB-41. Endorsed required for things like

                              WS support (EMB-61)

                          -->

                                  <argLine>-Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Djava.endorsed.dirs=${env.JBOSS_HOME}/lib/endorsed -Djboss.home=${env.JBOSS_HOME} -Djboss.boot.server.log.dir=${env.JBOSS_HOME}</argLine>

                              </configuration>

                          </plugin>

                      </plugins>

                  </build>

              </profile>       

       

          </profiles>

       

       

       

       

          <repositories>

              <!-- See this URL why the deprecated repository must be added:

              http://stackoverflow.com/questions/6556858/maven-artifact-jboss-as-client-broken-trovetrovejar2-1-1

              -->

              <repository>

                  <id>jboss-deprecated-repository</id>

                  <name>JBoss Deprecated Maven Repository</name>

                  <url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url>

                  <layout>default</layout>

                  <releases>

                      <enabled>true</enabled>

                      <updatePolicy>never</updatePolicy>

                  </releases>

                  <snapshots>

                      <enabled>false</enabled>

                      <updatePolicy>never</updatePolicy>

                  </snapshots>

              </repository>       

              <repository>

                  <id>JBoss</id>

                  <name>JBoss Repository</name>

                  <url>https://repository.jboss.org/nexus/content/groups/public/</url>

              </repository>

          </repositories>

      </project>

       

       

      The current problem is (with the embedded JBoss 6 container):

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (default-testCompile) on project ArquillianTestProject: Compilation failure

      [ERROR] /home/viggo/NetBeansProjects/ArquillianTestProject/src/test/java/com/mycompany/arquilliantestproject/TemperatureConverterTest.java:[32,9] cannot find symbol

      [ERROR] symbol  : method addAsManifestResource(org.jboss.shrinkwrap.api.asset.EmptyAsset,org.jboss.shrinkwrap.api.ArchivePath)

      [ERROR] location: interface org.jboss.shrinkwrap.api.spec.JavaArchive

      [ERROR] -> [Help 1]

      [ERROR]

       

      If I run it with the remote JBoss 6 container I get this:

      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.348 sec <<< FAILURE!

      initializationError(com.mycompany.arquilliantestproject.TemperatureConverterTest)  Time elapsed: 0.016 sec  <<< ERROR!

      org.jboss.arquillian.spi.client.container.LifecycleException: Could not connect to container

                at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.start(JBossASRemoteContainer.java:83)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$5.perform(ContainerLifecycleController.java:145)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$5.perform(ContainerLifecycleController.java:135)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:183)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.startContainer(ContainerLifecycleController.java:134)

                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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                at org.jboss.arquillian.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:78)

                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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:87)

                at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                at org.jboss.arquillian.impl.core.EventImpl.fire(EventImpl.java:67)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:83)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:76)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.forEachContainer(ContainerLifecycleController.java:176)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.startContainers(ContainerLifecycleController.java:75)

                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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                at org.jboss.arquillian.impl.core.EventImpl.fire(EventImpl.java:67)

                at org.jboss.arquillian.impl.client.ContainerEventController.execute(ContainerEventController.java:55)

                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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                at org.jboss.arquillian.impl.TestContextHandler.createSuiteContext(TestContextHandler.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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:87)

                at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:58)

                at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:86)

                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

                at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)

                at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)

                at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

                at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)

                at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

                at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)

                at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:33)

                at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)

                at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)

                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.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)

                at $Proxy0.invoke(Unknown Source)

                at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)

                at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)

                at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)

      Caused by: javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]

                at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1690)

                at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1761)

                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:695)

                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)

                at javax.naming.InitialContext.lookup(InitialContext.java:392)

                at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.initDeploymentManager(JBossASRemoteContainer.java:197)

                at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.start(JBossASRemoteContainer.java:79)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$5.perform(ContainerLifecycleController.java:145)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$5.perform(ContainerLifecycleController.java:135)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:183)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.startContainer(ContainerLifecycleController.java:134)

                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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                at org.jboss.arquillian.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:78)

                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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:87)

                at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                at org.jboss.arquillian.impl.core.EventImpl.fire(EventImpl.java:67)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:83)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:76)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.forEachContainer(ContainerLifecycleController.java:176)

                at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.startContainers(ContainerLifecycleController.java:75)

                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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                at org.jboss.arquillian.impl.core.EventImpl.fire(EventImpl.java:67)

                at org.jboss.arquillian.impl.client.ContainerEventController.execute(ContainerEventController.java:55)

                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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                at org.jboss.arquillian.impl.TestContextHandler.createSuiteContext(TestContextHandler.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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:87)

                at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:58)

                at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:86)

                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

                at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)

                at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)

                at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

                at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)

                at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

                at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)

                at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:33)

                at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)

                at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)

                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.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)

                at $Proxy0.invoke(Unknown Source)

                at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)

                at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)

                at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)

      Caused by: java.net.SocketTimeoutException: Receive timed out

                at java.net.PlainDatagramSocketImpl.receive0(Native Method)

                at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:145)

                at java.net.DatagramSocket.receive(DatagramSocket.java:725)

                at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1659)

                ... 82 more

      [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]]]

                at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1780)

                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:695)

                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)

                at javax.naming.InitialContext.lookup(InitialContext.java:392)

                at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.initDeploymentManager(JBossASRemoteContainer.java:197)

                at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.start(JBossASRemoteContainer.java:79)

                ... 76 more

      Caused by: javax.naming.CommunicationException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]]

                at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:337)

                at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1746)

                ... 81 more

      Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]

                at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:307)

                ... 82 more

      Caused by: java.net.ConnectException: Connection refused

                at java.net.PlainSocketImpl.socketConnect(Native Method)

                at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)

                at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)

                at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)

                at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

                at java.net.Socket.connect(Socket.java:529)

                at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:97)

                at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:82)

                at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:303)

                ... 82 more

       

       

       

       

      ANY input would be very much appreciated

        • 1. Re: Problem using Jboss 6 remote and embedded container in Arquillian
          Viggo Navarsete Expert

          Input from IRC(JBoss testing):

          - In order to use the profile jbossas-remote-6 you need *a running JBoss server* (http://docs.jboss.org/arquillian/reference/latest/en-US/html/container.reference.html#container.jbossas-remote-6)

          - If you want Arquillian to start/stop the JBoss server, use the jbass-embedded-6 instead. (http://docs.jboss.org/arquillian/reference/latest/en-US/html/container.reference.html#container.jbossas-embedded-6)

          - Remember to set JBOSS_HOME if you want to run with jbass-embedded-6

          • 2. Re: Problem using Jboss 6 remote and embedded container in Arquillian
            Viggo Navarsete Expert

            I used an old version of Arquillian, Alpha5, while a CR1 is out. I used it due to old documentation available. I should have used the documentation found here:

            https://docs.jboss.org/author/display/ARQ/Reference+Guide

             

            and not this one (DEPRECATED!): http://docs.jboss.org/arquillian/reference/latest/

             

            When updating from using Alpha5 to to 1.0.0.CR1 you probably should read this page: http://community.jboss.org/wiki/MigrationToArquillian100CR1

             

            When using Arquillian 1.0.0.CR1 you can (will?) run into a problem like this:

            [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (default-testCompile) on project ArquillianTestProject: Compilation failure

            [ERROR] /home/viggo/Desktop/ArquillianTestProject/src/test/java/com/mycompany/arquilliantestproject/TemperatureConverterTest.java:[32,9] cannot find symbol

            [ERROR] symbol  : method addAsManifestResource(org.jboss.shrinkwrap.api.asset.EmptyAsset,org.jboss.shrinkwrap.api.ArchivePath)

            [ERROR] location: interface org.jboss.shrinkwrap.api.spec.JavaArchive

            [ERROR] -> [Help 1]

             

            I tried to do what's described in https://issues.jboss.org/browse/ARQ-488 since I was told it could be related to a wrong shrinkwrap being used,

            but it didn't help, same output. For fun I changed

            <dependency>

                        <groupId>org.jboss.shrinkwrap</groupId>

                        <artifactId>shrinkwrap-impl-base</artifactId>

                    </dependency>

             

            into

                    <dependency>

                        <groupId>org.jboss.shrinkwrap</groupId>

                        <artifactId>shrinkwrap-api</artifactId>

                        <version>1.0.0-alpha-13</version>

                    </dependency>

             

            and now I get this output:

            -------------------------------------------------------------------------------

            Test set: com.mycompany.arquilliantestproject.TemperatureConverterTest

            -------------------------------------------------------------------------------

            Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.59 sec <<< FAILURE!

            com.mycompany.arquilliantestproject.TemperatureConverterTest  Time elapsed: 0 sec  <<< ERROR!

            java.lang.RuntimeException: Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor see cause.

                      at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:169)

                      at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)

                      at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:72)

                      at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)

                      at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)

                      at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)

                      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.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)

                      at $Proxy0.invoke(Unknown Source)

                      at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)

                      at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)

                      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)

            Caused by: java.lang.reflect.InvocationTargetException

                      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

                      at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:165)

                      ... 14 more

            Caused by: org.jboss.arquillian.container.impl.ContainerCreationException: Could not create Container jbossas

                      at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:80)

                      at org.jboss.arquillian.container.impl.client.container.ContainerRegistryCreator.createRegistry(ContainerRegistryCreator.java:68)

                      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:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)

                      at org.jboss.arquillian.core.impl.ManagerImpl.bindAndFire(ManagerImpl.java:235)

                      at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74)

                      at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:58)

                      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:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:134)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)

                      at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:260)

                      at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:56)

                      ... 19 more

            Caused by: java.lang.IllegalArgumentException: DeployableContainer must be specified

                      at org.jboss.arquillian.core.spi.Validate.notNull(Validate.java:44)

                      at org.jboss.arquillian.container.impl.ContainerImpl.<init>(ContainerImpl.java:43)

                      at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:72)

                      ... 43 more

             

            Not sure if I'm closer to a solution or not, but this is the current state of my problem:)

            • 3. Re: Problem using Jboss 6 remote and embedded container in Arquillian
              Viggo Navarsete Expert

              Now the embedded JBoss server is up and running (had different versions of Arquiilian as dependency and in the profile). The problem now is this:

              -------------------------------------------------------------------------------

              Test set: com.mycompany.arquilliantestproject.TemperatureConverterTest

              -------------------------------------------------------------------------------

              Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 17.926 sec <<< FAILURE!

              com.mycompany.arquilliantestproject.TemperatureConverterTest  Time elapsed: 0 sec  <<< ERROR!

              java.lang.NoSuchMethodError: org.jboss.shrinkwrap.api.spec.JavaArchive.addAsServiceProvider(Ljava/lang/Class;[Ljava/lang/Class;)Lorg/jboss/shrinkwrap/api/Archive;

                        at org.jboss.arquillian.testenricher.cdi.client.CDIEnricherArchiveAppender.createAuxiliaryArchive(CDIEnricherArchiveAppender.java:42)

                        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.loadAuxiliaryArchives(DeploymentGenerator.java:198)

                        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.buildTestableDeployments(DeploymentGenerator.java:149)

                        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.createTestableDeployments(DeploymentGenerator.java:136)

                        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:85)

               

              So the question is: Which version of ShrinkWrap is working with Arquillian 1.0.0-CR2?

              • 4. Re: Problem using Jboss 6 remote and embedded container in Arquillian
                Viggo Navarsete Expert

                The following pom.xml has all the correct dependencies with correct version numbers, and will make the TemperatureConverter example work:

                 

                 

                <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

                    <modelVersion>4.0.0</modelVersion>

                 

                 

                    <groupId>com.mycompany</groupId>

                    <artifactId>ArquillianTestProject</artifactId>

                    <version>1.0-SNAPSHOT</version>

                    <packaging>war</packaging>

                 

                 

                    <name>ArquillianTestProject</name>

                 

                 

                    <properties>

                        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>

                        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

                        <arquillian.version>1.0.0.CR2</arquillian.version>

                        <!-- Override the managed version from jboss-as-depchain-->

                        <version.shrinkwrap_shrinkwrap>1.0.0-beta-3</version.shrinkwrap_shrinkwrap> 

                    </properties>

                 

                 

                 

                 

                    <dependencyManagement>

                        <dependencies>

                            <!-- Need to add shrinkwrap to overide those used by the embedded container,

                            which are way too old! -->

                            <dependency>

                                <groupId>org.jboss.shrinkwrap</groupId>

                                <artifactId>shrinkwrap-api</artifactId>

                                <version>${version.shrinkwrap_shrinkwrap}</version>

                            </dependency>

                            <dependency>

                                <groupId>org.jboss.shrinkwrap</groupId>

                                <artifactId>shrinkwrap-impl-base</artifactId>

                                <version>${version.shrinkwrap_shrinkwrap}</version>

                            </dependency>            

                        </dependencies>

                    </dependencyManagement>   

                 

                 

                    <dependencies>

                        <!--

                        Cant use this dependency, see here: http://community.jboss.org/wiki/WhatsTheCauseOfThisExceptionJavalangClassFormatErrorAbsentCode

                        dependency>

                            <groupId>javax</groupId>

                            <artifactId>javaee-web-api</artifactId>

                            <version>6.0</version>

                            <scope>provided</scope>

                        </dependency-->

                 

                 

                        <dependency>

                            <groupId>org.jboss.spec</groupId>

                            <artifactId>jboss-javaee-6.0</artifactId>

                            <version>2.0.0.Final</version>

                            <type>pom</type>

                            <scope>provided</scope>

                        </dependency>   

                        <dependency>

                            <groupId>javax.enterprise</groupId>

                            <artifactId>cdi-api</artifactId>

                            <version>1.0-SP4</version> 

                        </dependency>

                 

                 

                        <dependency>

                            <groupId>junit</groupId>

                            <artifactId>junit</artifactId>

                            <version>4.8.2</version>

                            <scope>test</scope>

                        </dependency>           

                       

                        <dependency>

                            <groupId>org.jboss.arquillian.junit</groupId>

                            <artifactId>arquillian-junit-container</artifactId>

                            <version>${arquillian.version}</version>

                            <scope>test</scope>

                        </dependency>      

                    </dependencies>

                 

                 

                    <build>

                        <plugins>

                            <plugin>

                                <groupId>org.apache.maven.plugins</groupId>

                                <artifactId>maven-compiler-plugin</artifactId>

                                <version>2.3.2</version>

                                <configuration>

                                    <source>1.6</source>

                                    <target>1.6</target>

                                    <compilerArguments>

                                        <endorseddirs>${endorsed.dir}</endorseddirs>

                                    </compilerArguments>

                                </configuration>

                            </plugin>

                            <plugin>

                                <groupId>org.apache.maven.plugins</groupId>

                                <artifactId>maven-war-plugin</artifactId>

                                <version>2.1.1</version>

                                <configuration>

                                    <failOnMissingWebXml>false</failOnMissingWebXml>

                                </configuration>

                            </plugin>

                            <plugin>

                                <groupId>org.apache.maven.plugins</groupId>

                                <artifactId>maven-dependency-plugin</artifactId>

                                <version>2.1</version>

                                <executions>

                                    <execution>

                                        <phase>validate</phase>

                                        <goals>

                                            <goal>copy</goal>

                                        </goals>

                                        <configuration>

                                            <outputDirectory>${endorsed.dir}</outputDirectory>

                                            <silent>true</silent>

                                            <artifactItems>

                                                <artifactItem>

                                                    <groupId>javax</groupId>

                                                    <artifactId>javaee-endorsed-api</artifactId>

                                                    <version>6.0</version>

                                                    <type>jar</type>

                                                </artifactItem>

                                            </artifactItems>

                                        </configuration>

                                    </execution>

                                </executions>

                            </plugin>

                        </plugins>

                    </build>

                 

                 

                    <profiles>

                        <profile>

                            <id>jbossas-embedded-6</id>

                            <dependencies>

                                <dependency>

                                    <groupId>org.jboss.arquillian.container</groupId>

                                    <artifactId>arquillian-jbossas-embedded-6</artifactId>

                                    <version>${arquillian.version}</version>

                                </dependency>

                                <dependency>

                                    <groupId>org.jboss.jbossas</groupId>

                                    <artifactId>jboss-as-depchain</artifactId>

                                    <version>6.0.0.Final</version>

                                    <type>pom</type>

                                </dependency>

                            </dependencies>

                            <dependencyManagement>

                                <dependencies>

                                    <dependency>

                                        <groupId>org.jboss.jbossas</groupId>

                                        <artifactId>jboss-as-depchain</artifactId>

                                        <version>6.0.0.Final</version>

                                        <type>pom</type>

                                        <scope>import</scope>

                                    </dependency>

                                </dependencies>

                            </dependencyManagement>

                            <build>

                                <plugins>

                                    <plugin>

                                        <artifactId>maven-surefire-plugin</artifactId>

                                        <version>2.9</version>

                                        <configuration>

                                            <additionalClasspathElements>

                                                <additionalClasspathElement>${env.JBOSS_HOME}/client/jbossws-native-client.jar</additionalClasspathElement>

                                        <!--

                                            Because jbossweb.sar contains shared web.xml, which must be

                                            visible from same CL as TomcatDeployer.class.getClassLoader

                                        -->

                                            <additionalClasspathElement>${env.JBOSS_HOME}/server/default/deploy/jbossweb.sar</additionalClasspathElement>

                                            </additionalClasspathElements>

                                            <redirectTestOutputToFile>true</redirectTestOutputToFile>

                                            <trimStackTrace>false</trimStackTrace>

                                            <printSummary>true</printSummary>

                                            <forkMode>once</forkMode>

                                    <!--

                                        MaxPermSize Required to bump the space for relective data like

                                        classes, methods, etc. EMB-41. Endorsed required for things like

                                        WS support (EMB-61)

                                    -->

                                            <argLine>-Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Djava.endorsed.dirs=${env.JBOSS_HOME}/lib/endorsed -Djboss.home=${env.JBOSS_HOME} -Djboss.boot.server.log.dir=${env.JBOSS_HOME}</argLine>

                                        </configuration>

                                    </plugin>

                                </plugins>

                            </build>

                        </profile>                               

                    </profiles>

                 

                 

                 

                 

                    <repositories>     

                        <repository>

                            <id>JBoss</id>

                            <name>JBoss Repository</name>

                            <url>https://repository.jboss.org/nexus/content/groups/public/</url>

                        </repository>

                    </repositories>

                </project>

                 

                 

                Remember to set environment variable JBOSS_HOME!!...otherwise, you won't get your container up and running!

                 

                Here is the TemperatureConverterTest.java as well:

                /*

                * To change this template, choose Tools | Templates

                * and open the template in the editor.

                */

                package com.mycompany.arquilliantestproject;

                 

                 

                import javax.inject.Inject;

                import junit.framework.Assert;

                import org.jboss.arquillian.container.test.api.Deployment;

                import org.jboss.arquillian.junit.Arquillian;

                import org.jboss.shrinkwrap.api.ArchivePaths;

                import org.jboss.shrinkwrap.api.ShrinkWrap;

                import org.jboss.shrinkwrap.api.asset.EmptyAsset;

                import org.jboss.shrinkwrap.api.spec.JavaArchive;

                import org.junit.Test;

                import org.junit.runner.RunWith;

                 

                 

                /**

                *

                * @author viggo

                */

                @RunWith(Arquillian.class)

                public class TemperatureConverterTest {

                 

                 

                   @Inject

                   private TemperatureConverter converter;

                 

                 

                   @Deployment

                   public static JavaArchive createTestArchive() {

                      return ShrinkWrap.create(JavaArchive.class)

                         .addClasses(TemperatureConverter.class)

                         .addAsManifestResource(

                            EmptyAsset.INSTANCE,

                            ArchivePaths.create("beans.xml"));

                   }

                 

                 

                   @Test

                   public void testConvertToCelsius() {

                      Assert.assertEquals(converter.convertToCelsius(32d), 0d);

                      Assert.assertEquals(converter.convertToCelsius(212d), 100d);

                   }

                 

                 

                   @Test

                   public void testConvertToFarenheit() {

                      Assert.assertEquals(converter.convertToFarenheit(0d), 32d);

                      Assert.assertEquals(converter.convertToFarenheit(100d), 212d);

                   }   

                }