4 Replies Latest reply on Mar 29, 2017 4:15 PM by mjobanek

    Cannot get Arquillian to work with remote Wildfly

    savvas.andreas

      Hello There,

       

      I am following the instructions at the Arquillian page to set up a very simple test that will run in a remote (running locally) Wildfly instance. So far, I have the following:

       

      My project structure is the following:

      ├── pom.xml

      └── src

          ├── main

          │   ├── java

          │   │   └── setup

          │   │       └── Greeter.java

          │   └── resources

          └── test

              ├── java

              │   └── setup

              │       └── GreeterTest.java

              └── resources

                  └── arquillian.xml

       

      with pom.xml being:

       

      <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>sandbox</groupId>

          <artifactId>arquillian</artifactId>

          <version>0.0.1-SNAPSHOT</version>

         

          <properties>

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

          </properties>

       

          <dependencyManagement>

              <dependencies>

                  <dependency>

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

                      <artifactId>arquillian-bom</artifactId>

                      <version>1.1.3.Final</version>

                      <scope>import</scope>

                      <type>pom</type>

                  </dependency>

                  <dependency>

                      <groupId>xalan</groupId>

                      <artifactId>xalan</artifactId>

                      <version>2.7.1</version>

                  </dependency>

              </dependencies>

          </dependencyManagement>

       

          <build>

              <plugins>

                  <plugin>

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

                      <version>3.1</version>

                      <configuration>

                          <source>1.7</source>

                          <target>1.7</target>

                      </configuration>

                  </plugin>

                  <plugin>

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

                      <version>2.16</version>

                  </plugin>

              </plugins>

          </build>

          <dependencies>

              <dependency>

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

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

                  <version>3.0.2.Final</version>

                  <type>pom</type>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>junit</groupId>

                  <artifactId>junit</artifactId>

                  <version>4.11</version>

                  <scope>test</scope>

              </dependency>

              <dependency>

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

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

                  <scope>test</scope>

              </dependency>

              <dependency>

                  <groupId>org.jboss.as</groupId>

                  <artifactId>jboss-as-arquillian-container-remote</artifactId>

                  <version>7.2.0.Final</version>

                  <scope>test</scope>

              </dependency>

              <dependency>

                  <groupId>org.jboss.weld</groupId>

                  <artifactId>weld-core</artifactId>

                  <version>2.1.2.Final</version>

                  <scope>test</scope>

              </dependency>

              <dependency>

                  <groupId>org.slf4j</groupId>

                  <artifactId>slf4j-simple</artifactId>

                  <version>1.7.6</version>

                  <scope>test</scope>

              </dependency>

              <dependency>

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

                  <artifactId>arquillian-protocol-servlet</artifactId>

                  <scope>test</scope>

              </dependency>

              <dependency>

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

                  <artifactId>arquillian-protocol-servlet</artifactId>

                  <scope>test</scope>

              </dependency>

          </dependencies>

      </project>

       

      and arquillian.xml being:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!--

          JBoss, Home of Professional Open Source

          Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual

          contributors by the @authors tag. See the copyright.txt in the

          distribution for a full listing of individual contributors.

       

          Licensed under the Apache License, Version 2.0 (the "License");

          you may not use this file except in compliance with the License.

          You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

          Unless required by applicable law or agreed to in writing, software

          distributed under the License is distributed on an "AS IS" BASIS,

          WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

          See the License for the specific language governing permissions and

          limitations under the License.

      -->

      <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">

       

         <!-- Uncomment to have test archives exported to the file system for inspection -->

      <!--    <engine>  -->

      <!--       <property name="deploymentExportPath">target/</property>  -->

      <!--    </engine> -->

       

         <!-- Force the use of the Servlet 3.0 protocol with all containers, as it is the most mature -->

         <defaultProtocol type="Servlet 3.0" />

      </arquillian>

       

      The main class and the test one the same as on the web site.

       

      Now, I start wildfly locally and verify that it is running (page on 8080 is showing) but when I run this test I'm getting the following error:

       

      Caused by: java.net.ConnectException: JBAS012144: Could not connect to remote://localhost:9999. The connection timed out

          at org.jboss.as.protocol.ProtocolConnectionUtils.connectSync(ProtocolConnectionUtils.java:130)

          at org.jboss.as.protocol.ProtocolConnectionManager$EstablishingConnection.connect(ProtocolConnectionManager.java:256)

       

      I am able to telnet localhost 9999 ok and I also found that arquillian doesn't seem to be picking up arquillian.xml cause if I deliberately malform this xml I'm getting the above error and not some xml parse error.

       

      Any ideas/suggestions would be much appreciated.

       

      Thanks,

      Savvas

        • 1. Re: Cannot get Arquillian to work with remote Wildfly
          kpiwko

          Hi Savvas,

           

          in your pom, your are defining AS7 remote container instead of wildfly

          <dependency>
                      <groupId>org.jboss.as</groupId>
                      <artifactId>jboss-as-arquillian-container-remote</artifactId>
                      <version>7.2.0.Final</version>
                      <scope>test</scope>
          </dependency>
          

           

          However, you rather want:

          <dependency>
              <groupId>org.wildfly</groupId>
              <artifactId>wildfly-arquillian-container-remote</artifactId>
              <version>8.0.0.Final</version>
              <scope>test</scope>
          </dependency>
          

           

          WF is using 9990 instead of 9999, hence it fails. For more details see WildFly 8 Final is released! · WildFly

          I expect that arquillian.xml is simply ignored if malformed and details are user. You can use -Darquilian.debug to see whether it was picked up before your exception was raised.

           

           

          HTH,

           

          Karel

          • 2. Re: Cannot get Arquillian to work with remote Wildfly
            savvas.andreas

            Hi Karel,

             

            Thanks very much, changing the container client dependency to the WildFly one did the trick!

             

            Interestingly enough, the correct port to use still seems to be 9999. Below is the content of my arquillian.xml:

             

            <?xml version="1.0" encoding="UTF-8"?>

            <!-- JBoss, Home of Professional Open Source Copyright 2013, Red Hat, Inc.

                and/or its affiliates, and individual contributors by the @authors tag. See

                the copyright.txt in the distribution for a full listing of individual contributors.

                Licensed under the Apache License, Version 2.0 (the "License"); you may not

                use this file except in compliance with the License. You may obtain a copy

                of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required

                by applicable law or agreed to in writing, software distributed under the

                License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS

                OF ANY KIND, either express or implied. See the License for the specific

                language governing permissions and limitations under the License. -->

            <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">

             

                <!-- Uncomment to have test archives exported to the file system for inspection -->

                <!-- <engine> -->

                <!-- <property name="deploymentExportPath">target/</property> -->

                <!-- </engine> -->

              

                <!-- Force the use of the Servlet 3.0 protocol with all containers, as it

                    is the most mature -->

                <defaultProtocol type="Servlet 3.0" />

                <!-- Example configuration for a remote JBoss Enterprise Application Platform

                    6 or AS 7 instance -->

                <container qualifier="jboss" default="true">

                    <!-- By default, arquillian will use the JBOSS_HOME environment variable.

                        Alternatively, the configuration below can be uncommented. -->

                    <configuration>

                        <property name="host">localhost</property>

                        <property name="jbossHome">/home/savvas/Software/JBoss/wildfly-8.0.0.Final</property>

                        <property name="managementAddress">127.0.0.1</property>

                        <property name="managementPort">9999</property>

                        <property name="username">admin</property>

                        <property name="password">XXXXX</property>

                    </configuration>

                </container>

            </arquillian>

             

            which seems to be working fine. When I change the "managementPort" value to be 9990 though I'm getting a timeout:

             

            Caused by: java.net.ConnectException: JBAS012144: Could not connect to http-remoting://127.0.0.1:9990. The connection timed out

             

            Cheers,

            Savvas

            • 3. Re: Cannot get Arquillian to work with remote Wildfly
              fdlprod

              hi,

               

              i had the same error locally with eclipse, what i have done allowed to use started server on local and on jenkins i have not the problem :

               

              add in arquillian.xml :

               

              <property name="allowConnectingToRunningServer">true</property>

               

              i never manage to make it work in local environment

              • 4. Re: Cannot get Arquillian to work with remote Wildfly
                mjobanek

                Hi Cyril,

                 

                please, add here your mvn dependency:tree