7 Replies Latest reply: Nov 28, 2012 12:03 PM by Aslak Knutsen RSS

    running tests in a domain mode jboss as 7.1.1

    alex_k Newbie

      I'm trying to setup arquillian example in our build environment. For the beginning I've tried to run the kitchensink example that comes with the Quickstarts package, only with a view modifiactions to fit our environment:

       

      Thats used the part of pom.xml, only the JBoss' Java EE 6 APIs and Tools version has been changed to 1.0.0.M7:

      <?xml version="1.0" encoding="UTF-8"?>
      <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/maven-v4_0_0.xsd">
         <modelVersion>4.0.0</modelVersion>
      
         <groupId>org.jboss.as.quickstarts</groupId>
         <artifactId>jboss-as-kitchensink</artifactId>
         <version>7.1.0.Final</version>
         <packaging>war</packaging>
         <name>JBoss AS Quickstarts: kitchensink</name>
         <description>A starter Java EE 6 webapp project for use on JBoss AS 7 / EAP 6, generated from the jboss-javaee6-webapp archetype</description>
      
         <properties>
            <!-- Explicitly declaring the source encoding eliminates the following 
               message: -->
            <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered 
               resources, i.e. build is platform dependent! -->
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <!-- Define the version of JBoss' Java EE 6 APIs and Tools we want to import.  -->
            <javaee6.with.tools.version>1.0.0.M7</javaee6.with.tools.version>
            <!-- Alternatively, comment out the above line, and un-comment the line below to 
              use version 3.0.0.Beta1-redhat-1 which is a release certified 
            to work with JBoss EAP 6. It requires you have access to the JBoss EAP 6 maven repository. -->
            <!-- 
            <javaee6.spec.version>3.0.0.Beta1-redhat-1</javaee6.spec.version> 
            -->
         </properties>
      
         <dependencyManagement>
            <dependencies>
              <!-- JBoss distributes a complete set of Java EE 6 APIs including a Bill 
                of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection) 
                of artifacts. We use this here so that we always get the correct versions 
                of artifacts. Here we use the jboss-javaee-6.0-with tools stack (you can read this as 
                the JBoss stack of the Java EE 6 APIs, with some extras tools for your project, such
                as Arquillian for testing) -->
               <dependency>
                  <groupId>org.jboss.bom</groupId>
                  <artifactId>jboss-javaee-6.0-with-tools</artifactId>
                  <version>${javaee6.with.tools.version}</version>
                  <type>pom</type>
                  <scope>import</scope>
               </dependency>
            </dependencies>
         </dependencyManagement>
      
         <dependencies>
      
            <!-- First declare the APIs we depend on and need for compilation. 
               All of them are provided by JBoss AS 7 -->
      
            <!-- Import the CDI API, we use provided scope as the API is included 
               in JBoss AS 7 -->
            <dependency>
               <groupId>javax.enterprise</groupId>
               <artifactId>cdi-api</artifactId>
               <scope>provided</scope>
            </dependency>
      
            <!-- Import the Common Annotations API (JSR-250), we use provided scope 
               as the API is included in JBoss AS 7 -->
            <dependency>
               <groupId>org.jboss.spec.javax.annotation</groupId>
               <artifactId>jboss-annotations-api_1.1_spec</artifactId>
               <scope>provided</scope>
            </dependency>
      
            <!-- Import the JAX-RS API, we use provided scope as the API is included 
               in JBoss AS 7 -->
            <dependency>
               <groupId>org.jboss.spec.javax.ws.rs</groupId>
               <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
               <scope>provided</scope>
            </dependency>
      
            <!-- Import the JPA API, we use provided scope as the API is included 
               in JBoss AS 7 -->
            <dependency>
               <groupId>org.hibernate.javax.persistence</groupId>
               <artifactId>hibernate-jpa-2.0-api</artifactId>
               <scope>provided</scope>
            </dependency>
      
            <!-- Import the EJB API, we use provided scope as the API is included 
               in JBoss AS 7 -->
            <dependency>
               <groupId>org.jboss.spec.javax.ejb</groupId>
               <artifactId>jboss-ejb-api_3.1_spec</artifactId>
               <scope>provided</scope>
            </dependency>
      
            <!-- JSR-303 (Bean Validation) Implementation -->
            <!-- Provides portable constraints such as @Email -->
            <!-- Hibernate Validator is shipped in JBoss AS 7 -->
            <dependency>
               <groupId>org.hibernate</groupId>
               <artifactId>hibernate-validator</artifactId>
               <version>4.2.0.Final</version>
               <scope>provided</scope>
               <exclusions>
                  <exclusion>
                     <groupId>org.slf4j</groupId>
                     <artifactId>slf4j-api</artifactId>
                  </exclusion>
               </exclusions>
            </dependency>
      
            <!-- Now we declare any tools needed -->
      
            <!-- Annotation processor to generate the JPA 2.0 metamodel classes 
               for typesafe criteria queries -->
            <dependency>
               <groupId>org.hibernate</groupId>
               <artifactId>hibernate-jpamodelgen</artifactId>
               <version>1.1.1.Final</version>
               <scope>provided</scope>
            </dependency>
      
            <!-- Needed for running tests (you may also use TestNG) -->
            <dependency>
               <groupId>junit</groupId>
               <artifactId>junit</artifactId>
               <scope>test</scope>
            </dependency>
      
            <!-- Optional, but highly recommended -->
            <!-- Arquillian allows you to test enterprise code such as EJBs and 
               Transactional(JTA) JPA from JUnit/TestNG -->
            <dependency>
               <groupId>org.jboss.arquillian.junit</groupId>
               <artifactId>arquillian-junit-container</artifactId>
               <scope>test</scope>
            </dependency>
            
            <dependency>
               <groupId>org.jboss.arquillian.protocol</groupId>
               <artifactId>arquillian-protocol-servlet</artifactId>
               <scope>test</scope>               
            </dependency>
      
         </dependencies>
      
         <build>
            <!-- Maven will append the version to the finalName (which is the name 
               given to the generated war, and hence the context root) -->
            <finalName>${project.artifactId}</finalName>
            <plugins>
               <!-- Compiler plugin enforces Java 1.6 compatibility and activates 
                  annotation processors -->
               <plugin>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <version>2.3.1</version>
                  <configuration>
                     <source>1.6</source>
                     <target>1.6</target>
                  </configuration>
               </plugin>
               <plugin>
                  <artifactId>maven-war-plugin</artifactId>
                  <version>2.1.1</version>
                  <configuration>
                     <!-- Java EE 6 doesn't require web.xml, Maven needs to catch 
                        up! -->
                     <failOnMissingWebXml>false</failOnMissingWebXml>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      
         <profiles>
            <profile>
               <!-- We add the JBoss repository as we need the JBoss AS connectors 
                  for Arquillian -->
               <repositories>
                  <!-- The JBoss Community public repository is a composite repository 
                     of several major repositories -->
                  <!-- see http://community.jboss.org/wiki/MavenGettingStarted-Users -->
                  <repository>
                     <id>jboss-public-repository</id>
                     <name>JBoss Repository</name>
                     <url>http://repository.jboss.org/nexus/content/groups/public</url>
                     <!-- These optional flags are designed to speed up your builds 
                        by reducing remote server calls -->
                     <releases>
                     </releases>
                     <snapshots>
                        <enabled>false</enabled>
                     </snapshots>
                  </repository>
               </repositories>
      
               <pluginRepositories>
                  <pluginRepository>
                     <id>jboss-public-repository</id>
                     <name>JBoss Repository</name>
                     <url>http://repository.jboss.org/nexus/content/groups/public</url>
                     <releases>
                     </releases>
                     <snapshots>
                        <enabled>false</enabled>
                     </snapshots>
                  </pluginRepository>
               </pluginRepositories>
      
               <!-- An optional Arquillian testing profile that executes tests 
                  in a remote JBoss AS instance -->
               <!-- Run with: mvn clean test -Parq-jbossas-remote -->
               <id>arq-jbossas-remote</id>
               <dependencies>
                  <dependency>
                     <groupId>org.jboss.as</groupId>
                     <artifactId>jboss-as-arquillian-container-remote</artifactId>
                     <scope>test</scope>
                  </dependency>
               </dependencies>
            </profile>
         </profiles>
      </project>
      

       

      The arquillian.xml:

      <?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">
      
         <defaultProtocol type="Servlet 3.0" />
      
         <!-- Example configuration for a remote JBoss AS 7 instance -->
         <container qualifier="jboss" default="true">
            <!-- If you want to use the JBOSS_HOME environment variable, just delete the jbossHome property -->
            <configuration>
                  <property name="managementAddress">localhost</property>
                  <property name="managementPort">9999</property>
                  <property name="username">admin</property>
                  <property name="password">password</property>
            </configuration>
         </container>
      
      </arquillian>
      

       

      If I run this setup in on local jboss setup, which is a jBoss AS 7.1.1 that runs in standalone mode, the tests pass.

      If I run this setup on our development server (by changing the managementAddress), which is jBoss AS 7.1.1 that runs in domain mode, the test fails with following exception:

       

      java.lang.RuntimeException: org.jboss.as.arquillian.container.ManagementClient$UnSuccessfulOperationException: "JBAS014792: Unknown attribute bound-address"
          at org.jboss.as.arquillian.container.ManagementClient.getBinding(ManagementClient.java:222)
          at org.jboss.as.arquillian.container.ManagementClient.getWebUri(ManagementClient.java:111)
          at org.jboss.as.arquillian.container.ManagementClient.getDeploymentMetaData(ManagementClient.java:117)
          at org.jboss.as.arquillian.container.CommonDeployableContainer.deploy(CommonDeployableContainer.java:150)
          at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:156)
          at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:123)
          at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:266)
          at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:122)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          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.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:78)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
          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:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
          at org.jboss.arquillian.container.impl.client.container.DeploymentExceptionHandler.verifyExpectedExceptionDuringDeploy(DeploymentExceptionHandler.java:50)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
          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.EventImpl.fire(EventImpl.java:67)
          at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:90)
          at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:79)
          at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.java:258)
          at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment(ContainerDeployController.java:234)
          at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployController.java:78)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          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.EventImpl.fire(EventImpl.java:67)
          at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:101)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          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.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
          at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
          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.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)
          at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:182)
          at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
          at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
          at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
          at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
          at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
          at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      Caused by: org.jboss.as.arquillian.container.ManagementClient$UnSuccessfulOperationException: "JBAS014792: Unknown attribute bound-address"
          at org.jboss.as.arquillian.container.ManagementClient.checkSuccessful(ManagementClient.java:317)
          at org.jboss.as.arquillian.container.ManagementClient.executeForResult(ManagementClient.java:310)
          at org.jboss.as.arquillian.container.ManagementClient.getBinding(ManagementClient.java:207)
          ... 90 more
      

       

      I couldn't find any information for that problem. Could it be related to the domain mode of the server?

       

      Thanks,

      Alex