1 Reply Latest reply on Feb 1, 2013 3:14 PM by potemkin

    Arquillian testing with JBoss 4.2.2 GA ends with "Could not get DeploymentManager"

    guiltzero

      Hi there,

       

      I've tried to do a simple test-example using arquillian on an installed JBoss, whose version is 4.2.2GA. I've spent tons of time on it and did a lot of readings in this comnunity and stackflow, but just couldn't figured out how to make it work.

       

      The  test is like this right now:

       

      package com.ultramain.system.view.test;
      
      import static org.junit.Assert.assertEquals;
      import static org.junit.Assert.assertTrue;
      
      import javax.ejb.EJB;
      
      import org.jboss.arquillian.container.test.api.Deployment;
      import org.jboss.arquillian.junit.Arquillian;
      import org.jboss.shrinkwrap.api.ShrinkWrap;
      import org.jboss.shrinkwrap.api.spec.JavaArchive;
      import org.jboss.shrinkwrap.api.asset.StringAsset;
      import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
      import org.jboss.shrinkwrap.descriptor.api.Descriptors;
      
      import org.junit.Test;
      import org.junit.runner.RunWith;
      
      import com.ultramain.system.view.test.IShrinkWrapBasicTest;
      import com.ultramain.system.view.test.ShrinkWrapBasicTest;
      
      @RunWith(Arquillian.class)
      public class QuerySimulationContainer {
      
          @EJB
          private IShrinkWrapBasicTest testObject;
      
          @Deployment
          public static JavaArchive createDeployment() {
          JavaArchive jar = ShrinkWrap.create(JavaArchive.class)
              .addClasses(QuerySimulationContainer.class,IShrinkWrapBasicTest.class,ShrinkWrapBasicTest.class);
          System.out.println(jar.toString(true));
          //System.out.println(jar.getContent());    
          return jar; 
          }
      
          @Test 
          public void testShrinkWrapWorks(){
              testObject = new ShrinkWrapBasicTest();
              assertEquals(testObject.getTestText(), "Test for ShrinkWrap");
          }
      }
      

       

      The interface and class required by the test unit are as follows:

       

      IShrinkWrapBasicTest.java:

       

      package com.ultramain.system.view.test;
      
      import javax.ejb.Remote;
      
      @Remote
      public interface IShrinkWrapBasicTest
      {
          public String getTestText();
      
          public void testMethod();
      }
      

       

      ShrinkWrapBasicTest.java:

       

      package com.ultramain.system.view.test;
      
      import javax.ejb.Stateless;
      import javax.ejb.Local;
      
      @Stateless
      public class ShrinkWrapBasicTest implements IShrinkWrapBasicTest
      { 
          public String getTestText()
          {
              return "Test for ShrinkWrap";
          }
      
          public void testMethod(){
          }
      
      }
      

       

      The changed part in my pom.XML is in <dependencies> and listed as following:

      pom.xml:

      <?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/xsd/maven-4.0.0.xsd">
      
      <!-- other parts in pom.XML which haven't been changed -->
      
          <dependencies>
              <!-- other dependency parts in original pom.XML, which haven't been changed after using arquillian -->
      
              <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-annotations</artifactId>
                  <version>3.2.1.ga</version>
              </dependency>
              <dependency>
                  <groupId>org.apache.commons</groupId>
                  <artifactId>commons-math</artifactId>
                  <version>2.0</version>
              </dependency>
              <dependency>
                  <groupId>javax.jee</groupId>
                  <artifactId>jee</artifactId>
                  <version>5.0</version>
                  <scope>provided</scope>
              </dependency>
              <dependency>
                  <groupId>jboss</groupId>
                  <artifactId>jboss-annotations-ejb3</artifactId>
                  <version>4.2.0.GA</version>
              </dependency>
              <dependency>
                  <groupId>org.jboss.arquillian</groupId>
                  <artifactId>arquillian-bom</artifactId>
                  <version>1.0.3.Final</version>
                  <scope>import</scope>
                  <type>pom</type>
              </dependency>            
              <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <version>4.8.1</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jboss.arquillian.junit</groupId>
                  <artifactId>arquillian-junit-container</artifactId>
                  <version>1.0.3.Final</version>            
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>javax.ejb</groupId>
                  <artifactId>ejb-api</artifactId>
                  <version>3.0</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>dom4j</groupId>
                  <artifactId>dom4j</artifactId>
                  <version>1.6.1-jboss</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jboss.spec</groupId>
                  <artifactId>jboss-javaee-5.0</artifactId>
                  <version>1.0.0.GA</version>
                  <type>pom</type>
                  <scope>provided</scope>
              </dependency>    
              <dependency>
                  <groupId>org.jboss.client</groupId>
                   <artifactId>jmx-invoker-adaptor-client</artifactId>
                    <version>4.2.2.GA</version>
                    <scope>test</scope>
              </dependency>    
              <dependency>
                  <groupId>org.jboss.arquillian.container</groupId>
                  <artifactId>arquillian-jbossas-remote-4.2</artifactId>
                  <version>1.0.0.Final-SNAPSHOT</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                <groupId>org.jboss.arquillian.container</groupId>
                <artifactId>arquillian-container-spi</artifactId>
                <version>1.0.3.Final</version>
                <scope>test</scope>
              </dependency>
              <dependency>
                <groupId>org.jboss.arquillian.container</groupId>
                <artifactId>arquillian-container-test-spi</artifactId>
                <version>1.0.3.Final</version>
                <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jboss.arquillian.protocol</groupId>
                  <artifactId>arquillian-protocol-servlet</artifactId>
                  <version>1.0.3.Final</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>jboss</groupId>
                  <artifactId>jbossall-client</artifactId>
                  <version>4.2.2.GA</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jboss.deployers</groupId>
                  <artifactId>jboss-deployers-client-spi</artifactId>
                  <version>2.2.2.GA</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                <groupId>org.jboss.deployers</groupId>
                <artifactId>jboss-deployers-core-spi</artifactId>
                <version>2.2.2.GA</version>
                    <scope>test</scope>
              </dependency>         
              <dependency>
                  <groupId>org.jboss.shrinkwrap.descriptors</groupId>
                  <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
                  <version>2.0.0-alpha-4</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                <groupId>org.jboss.shrinkwrap</groupId>
                <artifactId>shrinkwrap-api</artifactId>
                <version>1.1.1-alpha-2</version>
                <scope>test</scope>
              </dependency>
              <dependency>
                <groupId>org.jboss.shrinkwrap.resolver</groupId>
                <artifactId>shrinkwrap-resolver-bom</artifactId>
                <version>2.0.0-alpha-6</version>
                <type>pom</type>
                <scope>test</scope>
              </dependency>
              <dependency>
                <groupId>org.jboss.shrinkwrap.resolver</groupId>
                <artifactId>shrinkwrap-resolver-depchain</artifactId>
                <version>2.0.0-alpha-6</version>
                <type>pom</type>
                <scope>test</scope>
              </dependency>    
      
             <!-- other dependency parts in original pom.XML, which haven't been changed after using arquillian -->
          </dependencies>
      <!-- other parts in original pom.XML, which haven't been changed after using arquillian -->
      </project>
      

       

      I'm using a jndi.properties file, an aquillian.launch file, and another arquillian.xml listed below:

       

      jndi.properties (URL here is the ip address where we use to start JBOSS server) :

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming\:org.jnp.interfaces 
      java.naming.provider.url=jnp://URL:1099
      

       

      arquilllian.launch:

      local
      

       

      arquillian.xml (URL here is the ip address where we use to start JBOSS server):

      <?xml version="1.0"?>
      <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="local" default="true">
              <configuration>
                  <property name="profileName">local</property>
                  <property name="providerUrl">jnp://URL:1099</property>      
                  <property name="contextFactory">org.jnp.interfaces.NamingContextFactory</property>
                  <property name="urlPkgPrefix">org.jboss.naming:org.jnp.interfaces</property>
              </configuration>   
              <protocol type="Servlet 2.5">
                      <property name="host">URL</property>
                      <property name="port">8080</property>
              </protocol>          
          </container>
      </arquillian>
      

       

      The failure trace is:

      org.jboss.arquillian.container.spi.client.container.LifecycleException: Could not connect to container
          at org.jboss.arquillian.container.jbossas.remote_4_2.JBossASRemoteContainer.start(JBossASRemoteContainer.java:97)
          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:94)
          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.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:94)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
          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:94)
          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:135)
          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
          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:94)
          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.createSuiteContext(TestContextHandler.java:60)
          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:94)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
          at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:68)
          at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:97)
          at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
          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: javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException: Could not get DeploymentManager
          at javax.enterprise.deploy.shared.factories.DeploymentFactoryManager.getDeploymentManager(DeploymentFactoryManager.java:138)
          at org.jboss.arquillian.container.jbossas.remote_4_2.JBossASRemoteContainer.createDeploymentManager(JBossASRemoteContainer.java:117)
          at org.jboss.arquillian.container.jbossas.remote_4_2.JBossASRemoteContainer.start(JBossASRemoteContainer.java:93)
          ... 61 more
      
      

       

      I've been stuck here for couple days, and tried everything I learned from other posts here as well as the examples in arquillian.container.jboss in Github. Kinda despair now... Could anyone see what's my mistake here? Did i miss anything in the pom file?

      Thanks in advance for any suggestions!

        • 1. Re: Arquillian testing with JBoss 4.2.2 GA ends with "Could not get DeploymentManager"
          potemkin

          I have this problem too, a managed jboss 4.2.3 works fine, here are the profiles I'm using in my pom.xml file:

           

                  <profile>
                      <id>arquillian-jbossas-managed-4</id>
                      <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>
                      <dependencies>
                          <dependency>
                              <groupId>dom4j</groupId>
                              <artifactId>dom4j</artifactId>
                              <version>1.6.1</version>
                              <scope>test</scope>
                          </dependency>
                          <dependency>
                              <groupId>org.jboss.arquillian.container</groupId>
                              <artifactId>arquillian-jbossas-managed-4.2</artifactId>
                              <version>1.0.0.CR3</version>
                              <scope>test</scope>
                          </dependency>
                          <dependency>
                              <groupId>org.jboss.client</groupId>
                              <artifactId>jbossall-client</artifactId>
                              <version>4.2.3.GA</version>
                              <scope>test</scope>
                          </dependency>
                          <dependency>
                              <groupId>org.jboss.jbossas</groupId>
                              <artifactId>jboss-server-manager</artifactId>
                              <version>1.0.3.GA</version>
                              <scope>test</scope>
                          </dependency>
                      </dependencies>
                  </profile>
          
                  <profile>
                      <id>arquillian-jbossas-remote-4</id>
                      <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.arquillian.container</groupId>
                              <artifactId>arquillian-jbossas-remote-4.2</artifactId>
                              <version>1.0.0.CR3</version>
                              <scope>test</scope>
                          </dependency>
                          <dependency>
                              <groupId>org.jboss.client</groupId>
                              <artifactId>jbossall-client</artifactId>
                              <version>4.2.3.GA</version>
                              <scope>provided</scope>
                          </dependency>
                      </dependencies>
                  </profile>
          

           

          halp!