7 Replies Latest reply on Feb 20, 2011 9:24 PM by Sergiy Litsenko

    Issue with TestNG integration tests deployment to remote JBoss AS 6.0.0.Final

    Sergiy Litsenko Newbie

      Hi,

      I'm integrating Arquillian 1.0.0.Alpha4 into our CI when building EAR based on Maven 3 and deploying to remote JBoss AS 6.0.0.0.Final. It fails with error (please see attached testng-results.xml for full stack trace):

      Caused by: org.jboss.profileservice.spi.NoSuchProfileException: Profile does not support deployment actions: ProfileKey@47755401[domain=default, server=default, name=standard]

          at org.jboss.profileservice.management.upload.DeploymentManagerImpl.checkProfile(DeploymentManagerImpl.java:309)

       

      The process I'm using during integration tests phase of maven:

      - cargo plugin starts the JBoss AS 6.0.0.0.Final standard profile [executed ok]


      - surefire executes testng deployment tests - JNDI checks, data sources checks, etc. [executed ok]

       

      - Arquillian/testng integration tests not deployed -  Arquillian reports "Could not connect to container" but the actual cause is "NoSuchProfileException"


      - cargo plugin stops the JBoss AS[executed ok]

       

      Any suggestions why Arquillian remote_6 container plugin can't deploy tests into running instance of JBoss ?


      Thank you.

       

       

      Regards,

        Sergiy

       

      arquillian.xml contents:

       

      <arquillian xmlns="http://jboss.com/arquillian"

              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                  xmlns:jbossas="urn:arq:org.jboss.arquillian.container.jbossas.remote_6">

       

          <engine>

                  <deploymentExportPath>./target</deploymentExportPath>

              </engine>

       

              <jbossas:container>

                  <jbossas:profileName>standard</jbossas:profileName>

                      <jbossas:remoteServerAddress>localhost</jbossas:remoteServerAddress>

                      <jbossas:remoteServerHttpPort>8080</jbossas:remoteServerHttpPort>

                      <jbossas:localDeploymentBindAddress>localhost</jbossas:localDeploymentBindAddress>

                      <jbossas:localDeploymentBindPort>9999</jbossas:localDeploymentBindPort>

              </jbossas:container>

      </arquillian>

       

      cargo plugin details:

       

                          <plugin>

                              <groupId>org.codehaus.cargo</groupId>

                                <artifactId>cargo-maven2-plugin</artifactId>

                                <configuration>

                                  <container>

                                        <containerId>jboss6x</containerId>

                                         <home>${project.build.directory}/${jboss.home}</home>

                                         <append>false</append>

                                         <log>${project.build.directory}/cargo-log.log</log>

                                      <!-- 5 minutes -->

                                      <timeout>300000</timeout>

                                        <systemProperties>

                                          <!-- This is used in jboss-log4j.xml -->

                                          <jboss.server.log.threshold>DEBUG</jboss.server.log.threshold>

                                        </systemProperties>                                  

                                  </container>

       

                                  <configuration>

                                        <type>existing</type>

                                        <home>${project.build.directory}/${jboss.home}/server/standard</home>

                                        <properties>

                                          <cargo.jboss.configuration>standard</cargo.jboss.configuration>

                                          <cargo.rmi.port>1099</cargo.rmi.port>

                                          <cargo.logging>high</cargo.logging>

                                        </properties>

       

                                      <deployables>

                                          <deployable>

                                                <location>${project.build.directory}/myapp.ear</location>

                                               <pingURL>http://localhost:${jboss.port}/myapp/index.htm</pingURL>

                                               <pingTimeout>120000</pingTimeout>

                                          </deployable>

                                      </deployables>

                                  </configuration>

                                    <wait>false</wait>

                                </configuration>

       

                                <executions>

                                  <execution>

                                        <id>start-container</id>

                                        <phase>pre-integration-test</phase>

                                        <goals>

                                          <goal>start</goal>

                                        </goals>

                                  </execution>

       

                                  <execution>

                                        <id>stop-container</id>

                                        <phase>post-integration-test</phase>

                                        <goals>

                                          <goal>stop</goal>

                                        </goals>

                                  </execution>

                                </executions>       

                          </plugin>

        • 1. Issue with TestNG integration tests deployment to remote JBoss AS 6.0.0.Final
          Aslak Knutsen Master

          It seems like we have a api missunderstanding going here..

           

          https://issues.jboss.org/browse/ARQ-365

           

          If you remove the profileName in your arquillian.xml, it should work..

          • 2. Issue with TestNG integration tests deployment to remote JBoss AS 6.0.0.Final
            Sergiy Litsenko Newbie

            Thanks, Aslak.Now Arquillian trying to deploy and run tests. But tests failed because they relying on our EAR deployed first, and EAR deployment above now failing - it is somehow now bundles Arquillian together with EAR despite I tried to set scopes to provided and then to  test. Any suggestions how can I tune it?


            P.S. With Arquillian disabled the EAR deployment successful.

             

            thanks,

              Sergiy

            • 3. Issue with TestNG integration tests deployment to remote JBoss AS 6.0.0.Final
              Aslak Knutsen Master

              Not quite sure i understand..

               

              Can you paste the @Deployment method and the exception your getting?

              • 4. Re: Issue with TestNG integration tests deployment to remote JBoss AS 6.0.0.Final
                Sergiy Litsenko Newbie

                No prob -I'll try to explain

                I have an EAR project with following structure:

                myEAR project

                   -- myEAR module

                   - myEJB module

                   -myWAR module

                  pom.xml

                 

                So, the scope of the issue is related to myEAR module only.

                The "myEAR module"  builds as expected the entire EAR. For the integration tests it has a profile that runs CARGO plugin (see extract from Maven pom above) that installs EAR into remote JBoss AS 6.0.0.Final server. Once EAR has been installed, the deployment tests are running to check availability of JMS queues, topics, Data sources (MyDB), etc required by myEAR.  BTW this process already been tested and successful.

                Then I've developed one more test case based on Arquillian to try to test something in container as part of other tests for "myEAR module".

                The test cases below relying on that fact -so actually nothing needed to be deployed except test cases and  all required Arquillian libs - so PersistenceContextTestCase.createDeployment() contains only declaration for beans.

                 

                However, because Arquillian declared in the pom module, it is somehow now gets bundled with EAR (into its lib dir) by ear-plugin toghether with production code despite the fact I've declared scope for Arquillian to be test (I've played also with provided but same result).  And that causes unsuccessful deployment of EAR before tests. So, obviously those deployment tests that rely on  EAR now failing.

                 

                 

                P.S I can post entire pom for ear module - if needed.

                 

                InContainerIntegrationTestCase.java:

                 

                public class InContainerIntegrationTestCase extends Arquillian {

                ...

                }

                 

                 

                PersistenceContextTestCase.java (just simple test using Arquillian):

                 

                @Test(groups = {"integration"})

                public class PersistenceContextTestCase extends InContainerIntegrationTestCase {

                 

                    @PersistenceContext(unitName="MyDB")

                    EntityManager entityManager;

                 

                    /**

                     * Default constructor

                     */

                    public PersistenceContextTestCase() {

                    }

                 

                 

                 

                    /**

                     * Set up for the single test method

                     */

                    @Override

                    @BeforeMethod

                    protected void methodSetUp() throws Exception {

                        super.methodSetUp();

                    }

                 

                 

                    /**

                     * Tear down for the single test method

                     */

                    @Override

                    @AfterMethod

                    protected void methodTearDown() throws Exception {

                        // call super

                        super.methodTearDown();

                    }

                 

                 

                    @Deployment

                    public static JavaArchive createDeployment() {

                          return ShrinkWrap.create(JavaArchive.class, "test.jar").

                                      addManifestResource(new ByteArrayAsset("<beans/>".getBytes()), ArchivePaths.create("beans.xml"));

                    }     

                 

                    //

                    // Test Methods *******************************************************************************

                    //

                 

                    @Test

                    public void testInitialContext() throws Exception {

                        // Log start marker. The log end marker set by methodTearDown()

                        logStartTestMarker("testInitialContext");

                 

                        // get initial context

                        InitialContext ic= getInitialContext();

                 

                        // debug

                        if (logger.isDebugEnabled()) {

                            logger.debug(String.format("Initial context: %1$s", ic));

                        }

                 

                        // test

                        Assert.assertNotNull (ic, "Initial context shall be defined");

                    }

                 

                    @Test

                    public void testPersistenceContext() throws Exception {

                        // Log start marker. The log end marker set by methodTearDown()

                        logStartTestMarker("testPersistenceContext");

                 

                        // debug

                        if (logger.isDebugEnabled()) {

                            logger.debug(String.format("Entity Manager: %1$s", entityManager));

                        }

                 

                        // test

                        Assert.assertNotNull (entityManager, "Entity Manager shall be injected for 'ObjectiveDB' persistence context");

                 

                        // get properties

                        Object delegate = entityManager.getDelegate();

                 

                        // debug

                        if (logger.isDebugEnabled()) {

                            logger.debug(String.format("Entity Manager delegate: %1$s", delegate));

                        }

                 

                        // test

                        Assert.assertNotNull (delegate, "Entity Manager delegate shall be provided");

                    }

                }

                 

                Thanks,

                   Sergiy

                • 5. Re: Issue with TestNG integration tests deployment to remote JBoss AS 6.0.0.Final
                  Aslak Knutsen Master

                  So the basic issue is, the Maven ear plugin bundles up the Arquillian artifacts as part of the deployment even tho the Arquillian dependencies are scoped for test only? That sounds a bit odd. Not sure why it would do that, except that it's overwritten somewhere in your pom file.

                  • 6. Re: Issue with TestNG integration tests deployment to remote JBoss AS 6.0.0.Final
                    Sergiy Litsenko Newbie

                    Yeah, might be.  At the moment I'm not sure if its something to do with project POM file dependencies, EAR plugin, or entire maven infrastructure,

                    or Arquillian usage inside EAR plugin, so I appreciate any help in these directions.

                     

                    So I was wondering if you've tested or planning to test Arquillian in similar scenario (e.g. part of EAR module) for remote JBoss 6 final  - so I can check differences. I briefly looked at EAR plugin source code - seams to be simple, and its relying on comom maven dependency manager.


                    Alternatively, I might need to develop Integration Tests module to isolate Arquillian from EAR module completely - but in that case I would need to restart JBoss and redeploy EAR twice which I'm trying to avoid in the first place.

                     


                    • 7. Re: Issue with TestNG integration tests deployment to remote JBoss AS 6.0.0.Final
                      Sergiy Litsenko Newbie

                      Ok, I've created integration-tests module to split the Arquillian from ear module build. The integration-tests in a similar manner to ear module starts JBoss AS, and deploys the EAR before running integration tests. The EAR deployed successfully. The Arquillian tests failed with java.lang.IllegalStateException: Error launching test at http://localhost:8080/test/ArquillianServletRunner?outputMode=serializedObject&className=com.objective.ens.PersistenceContextTestCase&methodName=testInitialContext. Got 500 (Internal Server Error).

                      The JBoss AS log contains following error:

                      [12:33:39.219][info][talledLocalContainer] 12:33:39,219 INFO  [org.jboss.web.tomcat.service.deployers.TomcatDeployment] deploy, ctxPath=/test

                      [12:33:39.375][info][talledLocalContainer] 12:33:39,370 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/test].[ServletTestRunner]] Servlet.service() for servlet ServletTestRunner threw exception: java.lang.ClassNotFoundException: com.thoughtworks.qdox.model.AbstractInheritableJavaEntity from BaseClassLoader@233374b0{vfs:///C:/CHECKOUT/ens/enterprise-search/integration-tests/target/AppServer/server/standard/deploy/test.war}

                      [12:33:39.375][info][talledLocalContainer]     at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:480) [jboss-classloader.jar:2.2.0.GA]

                      [12:33:39.375][info][talledLocalContainer]     at java.lang.ClassLoader.loadClass(ClassLoader.java:248) [:1.6.0_21]

                      [12:33:39.375][info][talledLocalContainer]     at org.testng.TestNG.initializeAnnotationFinders(TestNG.java:751) [:]

                      [12:33:39.375][info][talledLocalContainer]     at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:892) [:]

                      [12:33:39.375][info][talledLocalContainer]     at org.testng.TestNG.runSuitesLocally(TestNG.java:876) [:]

                      [12:33:39.375][info][talledLocalContainer]     at org.testng.TestNG.run(TestNG.java:784) [:]

                      [12:33:39.376][info][talledLocalContainer]     at org.jboss.arquillian.testng.TestNGTestRunner.execute(TestNGTestRunner.java:54) [:]

                      [12:33:39.376][info][talledLocalContainer]     at org.jboss.arquillian.protocol.servlet_3.ServletTestRunner.doGet(ServletTestRunner.java:84) [:]

                      [12:33:39.376][info][talledLocalContainer]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [:1.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]

                      [12:33:39.376][info][talledLocalContainer]     at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]

                       

                       

                       

                      However,   QDox wasn't used by our EAR at all. Thre only trace to QDox is that JBoss AOP uses it:

                      +- org.jboss.jbossas:jboss-as-client:pom:6.0.0.Final:test

                      |  +- oswego-concurrent:concurrent:jar:1.3.4-jboss-update1:test

                      |  +- org.jboss.aop:jboss-aop:jar:client:2.2.1.GA:test

                      |  |  +- xml-apis:xml-apis:jar:1.3.04:test

                      |  |  +- org.apache.ant:ant:jar:1.7.1:test (version managed from 1.8.0)

                      |  |  |  \- org.apache.ant:ant-launcher:jar:1.7.1:test

                      |  |  +- javassist:javassist:jar:3.12.1.GA:test (version managed from 3.12.0.GA)

                      |  |  +- org.jboss.classpool:jboss-classpool-scoped:jar:1.0.0.Alpha6:test

                      |  |  +- org.jboss.classpool:jboss-classpool:jar:1.0.0.Alpha6:test

                      |  |  +- org.jboss:jboss-reflect:jar:2.2.0.Alpha5:test

                      |  |  +- qdox:qdox:jar:1.6.1:test

                      |  |  \- trove:trove:jar:1.0.2:test

                       

                       

                      Aslak, do you know if it is something to do with jboss-as-client version declared?

                      Thanks,

                         Sergiy

                       

                      P.S. jboss-as-client declared in POM as following:

                              <dependency>

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

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

                                 <version>6.0.0.Final</version>

                                  <type>pom</type>

                                  <scope>test</scope>

                              </dependency>

                       

                      P.S.S Explicitly including  qdox to the integration-tests module does not respolve the issue.