Observing a hang with importBuildOutput when used with Eclipse and Arquillian
robtbender Nov 20, 2013 4:15 PMHi!
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>