3 Replies Latest reply on Nov 22, 2013 3:30 AM by kpiwko

    Observing a hang with importBuildOutput when used with Eclipse and Arquillian

    robtbender

      Hi!

       

      I'm observing a hang with importBuildOutput and I need your help.

       

      (1) I'm using Arquillian to perform container testing. 

      (2) I'd like to get log4j working just as it works during a normal deployment.  In order to do that, I need to include the log4j library in my test.jar.

      (3) I researched adding the library directly to the shrinkwrap, but I'd prefer to deploy my test case in as similiar manor to my regular production load, so I'd like to use my Maven setup.

      (4) I'm using Eclipse Keplar, JDK 1.7, and external Maven instance (v 3.1.1).  I'm using JBoss AS 7.1.  I've configured two server instances, a 'production' instance and and instance to run Arquillian tests.

       

      I created a simple java class and a test class to illustrate the issue.  Below, I've copied out my test case.  Counter.class is a simple conversation scoped bean that returns the number of times it's called.  I've broken out the normal Shrinkwrap.create into mulitple statements in an attempt to observe where the hang occurs.  By hang, I mean that I see the test server start up, I do not see the test.jar file deployed, the screen halts, and within 5 seconds the 'javaw' process that kicked off the test jboss instance terminates.  I've copied the logs below the test case.  I've also copied in my pom.xml from Maven.  I'm hoping there is a simple misconfiguration somewhere and a 2nd set of eyes will spot it.  I'm happy to provide any additional information.

       

      package com.bender.arq;


      import static org.junit.Assert.*;

      import javax.inject.Inject;

      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.asset.EmptyAsset;

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

      import org.jboss.shrinkwrap.resolver.api.maven.archive.importer.MavenImporter;

      import org.jboss.shrinkwrap.resolver.api.maven.archive.importer.PomEquippedMavenImporter;

      import org.junit.Test;

      import org.junit.runner.RunWith;

       

       

      import com.rbender.Counter;

       

       

      @RunWith(Arquillian.class)

      public class CounterTest {

       

        @Deployment

        public static JavaArchive createDeployment() {

        JavaArchive javaArchive = null;

        System.out.println("Creating the java archive");

        MavenImporter mi = ShrinkWrap.create(MavenImporter.class);

        System.out.println("Maven Importer complete");

       

        PomEquippedMavenImporter pqmi = mi.loadPomFromFile("pom.xml");

        System.out.println("POM equipped maven import complete");

        System.out.println(pqmi.toString());

       

        pqmi.importBuildOutput();

        System.out.println("POM equipped import Build Output complete.");

       

       

        javaArchive = pqmi.as(JavaArchive.class);

        System.out.println("Done Creating the java archive, adding classes.");

       

       

        javaArchive.addClasses(Counter.class);

        javaArchive.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

        System.out.println(javaArchive.toString(true));

        return javaArchive;

        }

       

        @Inject

        Counter counter;

       

        @Test

        public void test() {

        assertNotNull(counter);

        }

      }

       

       

      Logs:

      Nov 20, 2013 10:08:04 AM org.jboss.as.arquillian.container.managed.ManagedDeployableContainer startInternal

      INFO: Starting container with: ["C:\Program Files\Java\jdk1.7.0_45\bin\java", -Xmx512m, -XX:MaxPermSize=128m, -ea, -Djboss.home.dir=C:\\Program Files\\JBoss\\jboss-as-7.1.0.Final Arq Server, -Dorg.jboss.boot.log.file=C:\\Program Files\\JBoss\\jboss-as-7.1.0.Final Arq Server/standalone/log/boot.log, -Dlogging.configuration=file:C:\\Program Files\\JBoss\\jboss-as-7.1.0.Final Arq Server/standalone/configuration/logging.properties, -Djboss.modules.dir=C:\Program Files\JBoss\jboss-as-7.1.0.Final Arq Server\modules, -Djboss.bundles.dir=C:\Program Files\JBoss\jboss-as-7.1.0.Final Arq Server\bundles, -jar, C:\Program Files\JBoss\jboss-as-7.1.0.Final Arq Server\jboss-modules.jar, -mp, C:\\Program Files\\JBoss\\jboss-as-7.1.0.Final Arq Server\modules, -jaxpmodule, javax.xml.jaxp-provider, org.jboss.as.standalone, -server-config, standalone.xml]

      10:08:04,779 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA

      10:08:04,978 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA

      10:08:05,023 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.0.Final "Thunder" starting

      10:08:05,729 INFO  [org.xnio] XNIO Version 3.0.3.GA

      10:08:05,729 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)

      10:08:05,738 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA

      10:08:05,745 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.2.GA

      10:08:05,759 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers

      10:08:05,762 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem

      10:08:05,772 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.

      10:08:05,783 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem

      10:08:05,785 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension

      10:08:05,795 INFO  [org.jboss.as.connector] (MSC service thread 1-15) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.7.Final)

      10:08:05,801 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem

      10:08:05,826 INFO  [org.jboss.as.naming] (MSC service thread 1-2) JBAS011802: Starting Naming Service

      10:08:05,853 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-9) JBAS015400: Bound mail session [java:jboss/mail/Default]

      10:08:05,868 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem

      10:08:05,875 INFO  [org.jboss.as.security] (MSC service thread 1-2) JBAS013100: Current PicketBox version=4.0.6.final

      10:08:05,993 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-15) JBoss Web Services - Stack CXF Server 4.0.1.GA

      10:08:06,069 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class com.microsoft.sqlserver.jdbc.SQLServerDriver (version 2.0)

      10:08:06,148 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-12) Starting Coyote HTTP/1.1 on http--127.0.0.1-18080

      10:08:06,238 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory C:\Program Files\JBoss\jboss-as-7.1.0.Final Arq Server\standalone\deployments

      10:08:06,239 INFO  [org.jboss.as.remoting] (MSC service thread 1-15) JBAS017100: Listening on /127.0.0.1:19999

      10:08:06,239 INFO  [org.jboss.as.remoting] (MSC service thread 1-6) JBAS017100: Listening on /127.0.0.1:14447

      10:08:06,256 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-9) JBAS010400: Bound data source [java:jboss/datasources/WhatToMineDS]

      10:08:06,347 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 1829ms - Started 134 of 205 services (70 services are passive or on-demand)

      Creating the java archive

      Maven Importer complete

      POM equipped maven import complete

      org.jboss.shrinkwrap.resolver.impl.maven.archive.importer.PomEquippedMavenImporterImpl@46d24aa

       

      <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.rbender</groupId>

        <artifactId>testLog4JCounter</artifactId>

        <version>0.0.1-SNAPSHOT</version>

        <packaging>war</packaging>

        <name>testLog4JCounter</name>

        <description>Small Maven Project with Arquilliam to test log4J</description>

       

       

        <properties>

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

        </properties>

       

       

        <build>

        <plugins>

        <plugin>

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

        <version>3.1</version>

        <configuration>

        <source>1.7</source>

        <target>1.7</target>

        </configuration>

        </plugin>

        <plugin>

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

        <artifactId>jboss-as-maven-plugin</artifactId>

        <version>7.4.Final</version>

        <configuration></configuration>

        </plugin>

        </plugins>

        </build>

       

       

        <dependencyManagement>

        <dependencies>

        <dependency>

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

        <artifactId>shrinkwrap-resolver-bom</artifactId>

        <version>2.1.0-alpha-1</version>

        <scope>import</scope>

        <type>pom</type>

        </dependency>

        <dependency>

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

        <artifactId>arquillian-bom</artifactId>

        <version>1.0.0.Final</version>

        <scope>import</scope>

        <type>pom</type>

        </dependency>

        </dependencies>

        </dependencyManagement>

       

       

        <dependencies>

        <dependency>

        <groupId>javax</groupId>

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

        <version>7.0</version>

        </dependency>

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

        <artifactId>log4j</artifactId>

        <version>1.2.16</version>

        </dependency>

        <dependency>

        <groupId>junit</groupId>

        <artifactId>junit</artifactId>

        <version>4.10</version>

        <scope>test</scope>

        </dependency>

        <dependency>

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

        <artifactId>shrinkwrap-api</artifactId>

        </dependency>

        <dependency>

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

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

        <scope>test</scope>

        </dependency>

        <dependency>

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

        <artifactId>shrinkwrap-resolver-depchain</artifactId>

        <scope>test</scope>

        <type>pom</type>

        </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-managed</artifactId>

        <version>7.1.1.Final</version>

        <scope>test</scope>

        </dependency>

        <dependency>

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

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

        <scope>test</scope>

        </dependency>

        </dependencies>

      </project>

        • 1. Re: Observing a hang with importBuildOutput when used with Eclipse and Arquillian
          kpiwko

          Hi Robert,

           

          I see following possible source of problems:

           

          * you are using JBoss AS 7.1.0 together with Arquillian AS 7.1.1 adaptor, please try to update AS to 7.1.1.Final

          * you are using Maven 3.1.1, please try to downgrade to 3.0.x

           

          If that does not help, here's some debugging info that would help. You can get more by:

           

          1/ -Darquillian.debug=true which will show the last event where Arquillian lifecycle got stuck

          2/ -DargLine="your logging property", see resolver/README.asciidoc at 4bce5f8f390896471a0dda325df0de261c49a25c · kpiwko/resolver · GitHub and setup logging for Resolver

           

          HTH,

           

          Karel

          1 of 1 people found this helpful
          • 2. Re: Observing a hang with importBuildOutput when used with Eclipse and Arquillian
            robtbender

            HI Karel,

             

            Thanks so much for the quick response.  Great to see that people are watching these threads!

             

            The first two solutions you mentioned above did not resolve the problem. I tried installing and running Maven 3.0.5 (externally to eclipse) with no luck.  I made sure to alter the settings in eclipse (Windows->Preferences->Maven->Installations) along with updating all of the run time configurations to the older version.  No luck, I'm still observing the hang.

             

            I then installed JBoss AS 7.1.1 (Good call!, I did not realize that I had an older version, should have looked that up first.... )  I setup my production and arquillian instance just as before, I was able to run the counter.class in my production instance, so that appears to be setup correctly.  I then ran an Arquillian test with the following '@Deployment' and it worked correctly (again, showing the new jboss arquillian instance is configured correctly)

             

              @Deployment

              public static JavaArchive createDeployment() {

              JavaArchive ja = ShrinkWrap.create(JavaArchive.class);

              ja.addClasses(Counter.class);

              ja.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

              System.out.println(ja.toString(true));

              return ja;

              }

             

            I then utilized the '"-Darquillian.debug=true" by altering the run configuration for the arquillian test. (Right-Click 'CounterTest.class'->Run Configurations.... Arguments Tab.... VM Arguments....

             

            Below is the output, does this help troubleshoot the issue?  I clicked on the runtime exception (it's hyperlinked in eclipse, but the copy-paste did not bring that over) only brings up a not-very-useful popup window telling me I have a runtime exception, but no stacktrace.

             

            (E) ManagerProcessing

              (O) LoadableExtensionLoader.load

              (E) ServiceLoader

            (E) ManagerStarted

              (O) ConfigurationRegistrar.loadConfiguration

              (E) ArquillianDescriptor

              (O) ContainerRegistryCreator.createRegistry

              (E) ContainerRegistry

              (O) ProtocolRegistryCreator.createRegistry

              (E) ProtocolRegistry

            (E) BeforeSuite

              (I) TestContextHandler.createSuiteContext

              (O) ContainerEventController.execute

              (E) ContainerMultiControlEvent

              (O) ClientDeployerCreator.createClientSideDeployer

              (E) Deployer

              (O) ContainerLifecycleController.setupContainers

              (E) SetupContainer

              (I) ContainerDeploymentContextHandler.createContainerContext

              (O) ContainerLifecycleController.setupContainer

              (E) BeforeSetup

              (E) Container

              (E) AfterSetup

              (O) ClientContainerControllerCreator.createClientSideContainerController

              (E) ContainerController

              (E) ContainerMultiControlEvent

              (O) ContainerLifecycleController.startSuiteContainers

              (E) StartContainer

              (I) ContainerDeploymentContextHandler.createContainerContext

              (O) ContainerLifecycleController.startContainer

              (E) BeforeStart

              (E) ManagementClient

              (E) ArchiveDeployer

              (E) InitialContext

              (E) AfterStart

            (E) BeforeClass

              (I) TestContextHandler.createSuiteContext

              (I) TestContextHandler.createClassContext

              (E) TestClass

              (O) ContainerEventController.execute

              (E) ContainerMultiControlEvent

              (O) ContainerLifecycleController.startClassContainers

              (E) Event

              (O) DeploymentGenerator.generateDeployment

            Creating the java archive

            Maven Importer complete

            POM equipped maven import complete

            org.jboss.shrinkwrap.resolver.impl.maven.archive.importer.PomEquippedMavenImporterImpl@5ee16306

              (E) RuntimeException

              (E) RuntimeException

              (E) RuntimeException

              (E) RuntimeException

            (E) AfterClass

              (I) TestContextHandler.createSuiteContext

              (I) TestContextHandler.createClassContext

              (E) TestClass

              (O) ClientBeforeAfterLifecycleEventExecuter.on

              (O) ServerSetupObserver.afterTestClass

              (O) ContainerEventController.execute

              (E) ContainerMultiControlEvent

              (O) ContainerDeployController.undeployManaged

              (E) ContainerMultiControlEvent

              (O) ContainerLifecycleController.stopManualContainers

              (E) ContainerMultiControlEvent

              (O) ContainerLifecycleController.stopClassContainers

            (E) AfterSuite

              (I) TestContextHandler.createSuiteContext

              (O) ContainerEventController.execute

              (E) ContainerMultiControlEvent

              (O) ContainerLifecycleController.stopSuiteContainers

              (E) StopContainer

              (I) ContainerDeploymentContextHandler.createContainerContext

              (O) ContainerLifecycleController.stopContainer

              (E) BeforeStop

              (O) ArquillianServiceDeployer.undeploy

              (E) AfterStop

            (E) ManagerStopping

            • 3. Re: Observing a hang with importBuildOutput when used with Eclipse and Arquillian
              kpiwko

              The debug output definitely helps. It shows that pqmi.as(JavaArchive.class) failed for some reason. That's probably why you see process termination within 5 seconds. Something must be eating the exception, which is strange.

              Can you run Maven with debug output (-X) or check target/surefire-reports if there is something?

               

              My personal guess - is the project you're trying to build defined via pom.xml really of <packing>jar</packaging>? If it is a war, you need to cast it to WebArchive instead.

               

              Cheers,

               

              Karel