0 Replies Latest reply on Feb 7, 2012 9:22 PM by Edison Seo

    Embedded Jboss 6 cannot work?

    Edison Seo Newbie

      Hi,

       

      I'm new to arquillian, and I've went through some articles & samples, and try to do unit test with arquillian under embedded jboss6. Somehow those samples are kind of expired.

      I've tried to make a very simple case, but failed. Pls refers to below details.

       

      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/maven-v4_0_0.xsd">
                <modelVersion>4.0.0</modelVersion>
                <groupId>com.aqtest.examples</groupId>
                <artifactId>aq-example</artifactId>
                <name>Arquillian Examples EJB3.1 JBoss AS 6 Embedded</name>
                <description>Simple Arquillian EJB3.1 JBoss AS 6 Embedded Project</description>
                <version>0.0.1-SNAPSHOT</version>
      
      
                <!-- Properties -->
                <properties>
                          <arquillian.version>1.0.0.CR1</arquillian.version>
                          <version.org.jboss.jbossas>6.0.0.Final</version.org.jboss.jbossas>
                          <JBOSS_HOME>${project.build.directory}/jboss-${version.org.jboss.jbossas}</JBOSS_HOME>
                          <version.junit>4.8</version.junit>
      
      
                </properties>
      
      
                <build>
                          <plugins>
                                    <!-- Compiler -->
                                    <plugin>
                                              <artifactId>maven-compiler-plugin</artifactId>
                                              <inherited>true</inherited>
                                              <configuration>
                                                        <source>1.6</source>
                                                        <target>1.6</target>
                                                        <showDeprecation>false</showDeprecation>
                                                        <showWarnings>true</showWarnings>
                                                        <optimize>true</optimize>
                                                        <compilerVersion>1.6</compilerVersion>
                                                        <fork>true</fork>
                                                        <argLine>-Xmx512M</argLine>
                                                        <executable>${JAVA_HOME}/bin/javac</executable>
                                              </configuration>
                                    </plugin>
      
      
                                    <!-- Surefire -->
                                    <plugin>
                                              <artifactId>maven-surefire-plugin</artifactId>
                                              <configuration>
                                                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                                                        <trimStackTrace>false</trimStackTrace>
                                                        <printSummary>true</printSummary>
                                                        <!-- <includes> <include>**/*UnitTest.java</include> </includes> -->
                                                        <forkMode>always</forkMode>
                                              </configuration>
                                    </plugin>
                          </plugins>
      
      
                </build>
                <dependencies>
                          <!-- JUnit -->
                          <dependency>
                                    <groupId>junit</groupId>
                                    <artifactId>junit</artifactId>
                                    <version>${version.junit}</version>
                          </dependency>
      
      
                          <dependency>
                                    <groupId>javax.enterprise</groupId>
                                    <artifactId>cdi-api</artifactId>
                                    <version>1.0-SP4</version>
                          </dependency>
                          <!-- Arquillian Test Harness -->
                          <dependency>
                                    <groupId>org.jboss.arquillian.junit</groupId>
                                    <artifactId>arquillian-junit-container</artifactId>
                                    <version>${arquillian.version}</version>
                                    <scope>test</scope>
                          </dependency>
                </dependencies>
      
      
                <profiles>
                          <profile>
                                    <id>jbossas-embedded-6</id>
                                    <activation>
                                              <activeByDefault>true</activeByDefault>
                                    </activation>
                                    <dependencies>
                                              <!-- Embedded container -->
                                              <dependency>
                                                        <groupId>org.jboss.arquillian.container</groupId>
                                                        <artifactId>arquillian-jbossas-embedded-6</artifactId>
                                                        <version>${arquillian.version}</version>
                                              </dependency>
                                              <!-- org.jboss.jbossas -->
                                              <dependency>
                                                        <groupId>org.jboss.jbossas</groupId>
                                                        <artifactId>jboss-as-depchain</artifactId>
                                                        <version>${version.org.jboss.jbossas}</version>
                                                        <type>pom</type>
                                              </dependency>
      
      
                                    </dependencies>
      
      
                                    <dependencyManagement>
                                              <dependencies>
      
      
                                                        <!-- org.jboss.jbossas -->
                                                        <dependency>
                                                                  <groupId>org.jboss.jbossas</groupId>
                                                                  <artifactId>jboss-as-depchain</artifactId>
                                                                  <version>${version.org.jboss.jbossas}</version>
                                                                  <type>pom</type>
                                                                  <scope>import</scope>
                                                        </dependency>
      
      
                                              </dependencies>
      
      
                                    </dependencyManagement>
                                    <build>
                                              <plugins>
                                                        <plugin>
                                                                  <artifactId>maven-surefire-plugin</artifactId>
                                                                  <executions>
                                                                            <execution>
                                                                                      <id>integration-test</id>
                                                                                      <phase>integration-test</phase>
                                                                                      <goals>
                                                                                                <goal>test</goal>
                                                                                      </goals>
      
      
                                                                                      <configuration>
                                                                                                <additionalClasspathElements>
                                                                                                          <additionalClasspathElement>${JBOSS_HOME}/client/jbossws-native-client.jar</additionalClasspathElement>
                                                                                                          <!-- Because jbossweb.sar contains shared web.xml, which must be 
                                                                                                                    visible from same CL as TomcatDeployer.class.getClassLoader -->
                                                                                                          <additionalClasspathElement>${JBOSS_HOME}/server/default/deploy/jbossweb.sar</additionalClasspathElement>
                                                                                                </additionalClasspathElements>
      
      
                                                                                                <redirectTestOutputToFile>true</redirectTestOutputToFile>
                                                                                                <trimStackTrace>false</trimStackTrace>
                                                                                                <printSummary>true</printSummary>
                                                                                                <!-- <includes> <include>**/*IntegrationTest.java</include> </includes> -->
                                                                                                <forkMode>always</forkMode>
      
      
                                                                                                <!-- MaxPermSize Required to bump the space for relective data like 
                                                                                                          classes, methods, etc. EMB-41. Endorsed required for things like WS support 
                                                                                                          (EMB-61) -->
                                                                                                <argLine>-Xmx512m -XX:MaxPermSize=256m
                                                                                                          -Djava.net.preferIPv4Stack=true
                                                                                                          -Djava.util.logging.manager=org.jboss.logmanager.LogManager
                                                                                                          -Djava.endorsed.dirs=${JBOSS_HOME}/lib/endorsed
                                                                                                          -Djboss.home=${JBOSS_HOME}
                                                                                                          -Djboss.boot.server.log.dir=${JBOSS_HOME}</argLine>
                                                                                      </configuration>
                                                                            </execution>
                                                                  </executions>
                                                        </plugin>
      
      
                                                        <!-- Get AS and put into "target" -->
                                                        <plugin>
                                                                  <groupId>org.apache.maven.plugins</groupId>
                                                                  <artifactId>maven-dependency-plugin</artifactId>
                                                                  <executions>
                                                                            <execution>
                                                                                      <id>unpack</id>
                                                                                      <phase>pre-integration-test</phase> <!-- So run before testing -->
                                                                                      <goals>
                                                                                                <goal>unpack</goal>
                                                                                      </goals>
                                                                                      <configuration>
                                                                                                <artifactItems>
                                                                                                          <artifactItem>
                                                                                                                    <groupId>org.jboss.jbossas</groupId>
                                                                                                                    <artifactId>jboss-as-distribution</artifactId>
                                                                                                                    <version>${version.org.jboss.jbossas}</version>
                                                                                                                    <type>zip</type>
                                                                                                                    <overWrite>false</overWrite>
                                                                                                                    <outputDirectory>${project.build.directory}</outputDirectory>
                                                                                                          </artifactItem>
                                                                                                </artifactItems>
                                                                                      </configuration>
                                                                            </execution>
                                                                  </executions>
                                                        </plugin>
      
      
                                              </plugins>
                                    </build>
                          </profile>
                </profiles>
      
      
      </project>
      
      

       

      Test class

      @RunWith(Arquillian.class)
      public class HelloEJBTest {
      
      
          @EJB
          private HelloEJB helloEJB;
          
          @Deployment
          public static JavaArchive createTestArchive() {
              return ShrinkWrap.create(JavaArchive.class, "helloEJB.jar")
                      .addClasses(HelloEJB.class);
          }
          /**
           * Test method for {@link com.test.aquillian.example.beans.HelloEJB#sayHelloEJB(java.lang.String)}.
           */
          @Test
          public void testHelloEJB() {
              String result = helloEJB.sayHelloEJB("Michael");
              assertEquals("Hello Michael", result);
          }
      
      
      }
      
      

       

       

      When I run mvn test -Pjbossas-embedded-6, there's error. Below is the detail information in surefire-reports.

       

      <testcase time="0" classname="com.test.aquillian.example.beans.HelloEJBTest" name="com.test.aquillian.example.beans.HelloEJBTest">
          <error message="Could not start container" type="org.jboss.arquillian.container.spi.client.container.LifecycleException">org.jboss.arquillian.container.spi.client.container.LifecycleException: Could not start container
      
      
                at org.jboss.arquillian.container.jbossas.embedded_6.JBossASEmbeddedContainer.start(JBossASEmbeddedContainer.java:106)
      
      
                at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$5.perform(ContainerLifecycleController.java:144)
      
      
                at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$5.perform(ContainerLifecycleController.java:134)
      
      
                at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:182)
      
      
                at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startContainer(ContainerLifecycleController.java:133)
      
      
                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: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.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: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.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:83)
      
      
                at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:76)
      
      
                at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forEachContainer(ContainerLifecycleController.java:175)
      
      
                at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startContainers(ContainerLifecycleController.java:75)
      
      
                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: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:83)
      
      
                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: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.createSuiteContext(TestContextHandler.java:54)
      
      
                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: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.beforeSuite(EventTestRunnerAdaptor.java:68)
      
      
                at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:76)
      
      
                at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
      
      
                at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
      
      
                at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
      
      
                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.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
      
      
                at $Proxy0.invoke(Unknown Source)
      
      
                at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
      
      
                at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
      
      
                at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
      
      
      Caused by: java.lang.Exception: Encountered exception in server startup
      
      
                at org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase.bootstrapMcAndDescriptors(AbstractMCServerBase.java:325)
      
      
                at org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase.doStart(AbstractMCServerBase.java:257)
      
      
                at org.jboss.bootstrap.impl.as.server.AbstractJBossASServerBase.doStart(AbstractJBossASServerBase.java:381)
      
      
                at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:413)
      
      
                at java.lang.Thread.run(Thread.java:619)
      
      
      Caused by: java.lang.IllegalStateException: Incompletely deployed:
      
      
      DEPLOYMENTS IN ERROR:
        Deployment &quot;JavassistInitializer&quot; is in error due to: java.lang.ClassNotFoundException: org.jboss.reflect.plugins.javassist.JavassistInitializer
      
      
      
      
                at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:278)
      
      
                at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:174)
      
      
                at org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase.bootstrapMcAndDescriptors(AbstractMCServerBase.java:314)
      
      
                ... 4 more
      
      
      </error>
          <system-out>@HL
      
      
      @HL-------------------------------------------------------
      
      
      @HL T E S T S
      
      
      @HL-------------------------------------------------------
      
      
      @SLRunning com.test.aquillian.example.beans.HelloEJBTest
      
      
      Boot Log available in: C:\Users\xyanfxu\AppData\Local\Temp\
      
      
      </system-out>
          <system-err>Feb 8, 2012 9:49:16 AM org.jboss.arquillian.container.impl.client.container.ContainerRegistryCreator getActivatedConfiguration
      
      
      INFO: Could not read active container configuration: null
      
      
      log4j:WARN No appenders could be found for logger (org.jboss.bootstrap.impl.base.server.AbstractServer).
      
      
      log4j:WARN Please initialize the log4j system properly.
      
      

       

      Can anyone offer some help? Or share me with a correct config for embedded jboss6.

      Thanks