5 Replies Latest reply on Aug 16, 2010 4:29 AM by Aslak Knutsen

    Arquillian 1.0.0.Alpha3 + JBoss 6 M4 Question

    Rick Kilcoyne Newbie

      Anyone having any luck getting this combination working with arquillian-jbossas-remote-6 or arquillian-jbossas-managed-6? I've followed the great documentation, but the best I've been able to get with arquillian-jbossas-managed-6 is the following when testing an injected EJB:

       

      <error message="java.lang.NullPointerException" type="org.jboss.arquillian.impl.event.FiredEventException">

      org.jboss.arquillian.impl.event.FiredEventException: java.lang.NullPointerException

      at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)

      at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)

      at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:62)

      at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:89)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

      at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)

      at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)

      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

      at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)

      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

      at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)

      at org.apache.maven.surefire.junit4.JUnit4TestSet.<init>(JUnit4TestSet.java:45)

      at org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:56)

      at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96)

      at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:209)

      at org.apache.maven.surefire.Surefire.run(Surefire.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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)

      at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)

      Caused by: java.lang.NullPointerException

      at org.jboss.jbossas.servermanager.ServerManager.getJavaEndorsedDirs(ServerManager.java:260)

      at org.jboss.jbossas.servermanager.ServerController.getEndorsedDirsProperty(ServerController.java:212)

      at org.jboss.jbossas.servermanager.ServerController.getStartCommandLine(ServerController.java:191)

      at org.jboss.jbossas.servermanager.ServerController.startServer(ServerController.java:101)

      at org.jboss.jbossas.servermanager.ServerManager.startServer(ServerManager.java:163)

      at org.jboss.arquillian.container.jbossas.managed_6.JBossASLocalContainer.start(JBossASLocalContainer.java:84)

      at org.jboss.arquillian.impl.handler.ContainerStarter.callback(ContainerStarter.java:52)

      at org.jboss.arquillian.impl.handler.ContainerStarter.callback(ContainerStarter.java:41)

      at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)

      ... 24 more

      </error>

      If anyone has solved this before, I'd appreciate the help. If more info is needed, let me know and I'll post.
      Rick
      BTW, When running with arquillian-jbossas-remote-6, I get the error:
      <error message="Absent Code attribute in method that is not native or abstract in class file javax/transaction/SystemException" type="java.lang.ClassFormatError">
      java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/transaction/SystemException
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
      at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:169)
      at org.jboss.remoting.marshal.MarshalFactory.loadMarshaller(MarshalFactory.java:433)
      at org.jboss.remoting.marshal.MarshalFactory.getMarshaller(MarshalFactory.java:360)
      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:90)
      at org.jboss.remoting.Client.invoke(Client.java:1961)
      at org.jboss.remoting.Client.invoke(Client.java:804)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.aspects.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.java:74)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.aop.generatedproxies.AOPProxy$0.getDeploymentManager(AOPProxy$0.java)
      at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.initDeploymentManager(JBossASRemoteContainer.java:222)
      at org.jboss.arquillian.container.jbossas.remote_6.JBossASRemoteContainer.start(JBossASRemoteContainer.java:85)
      at org.jboss.arquillian.impl.handler.ContainerStarter.callback(ContainerStarter.java:52)
      at org.jboss.arquillian.impl.handler.ContainerStarter.callback(ContainerStarter.java:41)
      at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
      at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
      at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:62)
      at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:89)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
      at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
      at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
      at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
      at org.apache.maven.surefire.junit4.JUnit4TestSet.<init>(JUnit4TestSet.java:45)
      at org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:56)
      at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96)
      at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:209)
      at org.apache.maven.surefire.Surefire.run(Surefire.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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
      at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
      </error>

      Odd right? I'm not doing anything fancy here -- just trying to see a simple EJB test run.
        • 1. Re: Arquillian 1.0.0.Alpha3 + JBoss 6 M4 Question
          Rick Kilcoyne Newbie

          Ah... Something just caught my eye -- the reference to the endorsed directory...

          • 3. Re: Arquillian 1.0.0.Alpha3 + JBoss 6 M4 Question
            Rick Kilcoyne Newbie

            Ok, got it. The first issue was too embarrassing to post. Let's just say, I was up a little to late to be writing my deploy code... Then I had to add the following dependencies before the arquillian dependencies in my POM:

             

            <dependency>

            <groupId>javax.servlet</groupId>

            <artifactId>servlet-api</artifactId>

            <version>2.5</version>

            <scope>provided</scope>

            </dependency>

             

            <dependency>

            <groupId>javax.transaction</groupId>

            <artifactId>transaction-api</artifactId>

            <version>1.1</version>

            <scope>provided</scope>

            </dependency>

             

            Without these I was getting:

             

            <error message="Absent Code attribute in method that is not native or abstract in class file javax/servlet/http/HttpServlet" type="java.lang.ClassFormatError"/>

             

            and

             

            <error message="Absent Code attribute in method that is not native or abstract in class file javax/transaction/SystemException" type="java.lang.ClassFormatError">

             

            not sure what that was about, but my tests are now working.

            • 4. Re: Arquillian 1.0.0.Alpha3 + JBoss 6 M4 Question
              Aslak Knutsen Master

              Rick Kilcoyne wrote:

               

               

              <error message="Absent Code attribute in method that is not native or abstract in class file javax/servlet/http/HttpServlet" type="java.lang.ClassFormatError"/>

               

              and

               

              <error message="Absent Code attribute in method that is not native or abstract in class file javax/transaction/SystemException" type="java.lang.ClassFormatError">

               

              not sure what that was about, but my tests are now working.

              It sounds like you have the Sun provided javaee-api library on your classpath. This library is meant for compile time only, and will break runtime.

              http://community.jboss.org/wiki/WhatsthecauseofthisexceptionjavalangClassFormatErrorAbsentCode

               

              Adding those two dependencies just worked by luck, they happened to be placed before javaee-api on the classpath by maven.

              • 5. Re: Arquillian 1.0.0.Alpha3 + JBoss 6 M4 Question
                Aslak Knutsen Master

                Rick Kilcoyne wrote:

                 

                <error message="java.lang.NullPointerException" type="org.jboss.arquillian.impl.event.FiredEventException">

                org.jboss.arquillian.impl.event.FiredEventException: java.lang.NullPointerException

                at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)

                at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)

                at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:62)

                at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:89)

                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

                at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)

                at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)

                at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

                at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)

                at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

                at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)

                at org.apache.maven.surefire.junit4.JUnit4TestSet.<init>(JUnit4TestSet.java:45)

                at org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:56)

                at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96)

                at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:209)

                at org.apache.maven.surefire.Surefire.run(Surefire.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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)

                at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)

                Caused by: java.lang.NullPointerException

                at org.jboss.jbossas.servermanager.ServerManager.getJavaEndorsedDirs(ServerManager.java:260)

                at org.jboss.jbossas.servermanager.ServerController.getEndorsedDirsProperty(ServerController.java:212)

                at org.jboss.jbossas.servermanager.ServerController.getStartCommandLine(ServerController.java:191)

                at org.jboss.jbossas.servermanager.ServerController.startServer(ServerController.java:101)

                at org.jboss.jbossas.servermanager.ServerManager.startServer(ServerManager.java:163)

                at org.jboss.arquillian.container.jbossas.managed_6.JBossASLocalContainer.start(JBossASLocalContainer.java:84)

                at org.jboss.arquillian.impl.handler.ContainerStarter.callback(ContainerStarter.java:52)

                at org.jboss.arquillian.impl.handler.ContainerStarter.callback(ContainerStarter.java:41)

                at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)

                ... 24 more

                </error>

                The error message could be a lot better in this case, but the issue is the JBoss AS 6 Managed Container require jbossHome and JavaHome information provided. This defaults to environment the variables $JBOSS_HOME and $JAVA_HOME. This can also be set as part of the container configuration in arquillian.xml

                 

                How to configure Arquillian:

                http://docs.jboss.org/arquillian/reference/latest/en-US/html_single/#containers.configuration

                 

                What options are available for JBoss AS 6.0 Managed:

                http://docs.jboss.org/arquillian/reference/latest/en-US/html_single/#container.jbossas-managed-6

                 

                Tracking:  https://jira.jboss.org/browse/ARQ-168