4 Replies Latest reply on May 2, 2011 9:37 AM by marx3

    Testing JBoss-app under Arquillian?

    rop Newbie

      Hi,

       

      I have a question, re. Arquillian for JBoss-project testing.

       

      If I understand it correctly, Arquillian will actually invoke an OpenEJB-container (rather than JBoss-container) and deploy the application into, while executing tests. Is this correct?

       

      If so, how do you handle the differences between the two container-implementations

      (like JBoss-specific extensions to EJB3, differences in JNDI-paths, etc)?

       

      Even if they are both JEE6-containers, they are not 100% compatible, as far as I know...

       

      Can you enlighten me, please? 

        • 1. Testing JBoss-app under Arquillian?
          rop Newbie

          For example, I get these errors when trying to deploy with Arquillian, even though the app works under JBoss:

           

           

          ERROR - FAIL ... MyBean1: @EJB mistakenly refers to a non-interface.  Use the beans business interface instead

          ERROR - FAIL ... MyBean2: @EJB mistakenly refers to a bean class mypackage.MyBean3.  Use the beans business interface instead

           

           

          Isnt this because of implementation-differences between OpenEJB and JBoss?

          • 2. Testing JBoss-app under Arquillian?
            marx3 Apprentice

            Arquillian run test in container which _you_ are choosing. It's you who decide. For example, you can run tests on JBoss. In remote managed and embedded configuration you run tests in full JBoss, the only difference is who and how start JBoss.

            • 3. Re: Testing JBoss-app under Arquillian?
              rop Newbie

              Thanks Marek for clarification!

              I got it now -- so it depends on what container you include in your project...

               

              I changed my pom.xml, removed openejb, and added this instead:

                    <dependency>

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

                      <artifactId>arquillian-jbossas-embedded-6</artifactId>

                      <version>1.0.0.Alpha5</version>

                      <scope>test</scope>

                    </dependency>

                    <dependency>

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

                      <artifactId>jboss-as-depchain</artifactId>

                      <version>6.0.0.Final</version>

                      <type>pom</type>

                    </dependency>

               

              But now get the errors below.

               

              Anyone can explain what causes this problem?

              2011-apr-29 17:10:05 org.jboss.arquillian.impl.client.container.ContainerRegistryCreator getActivatedConfiguration

              INFO: Could not read active container configuration: null

               

               

              org.jboss.arquillian.impl.client.deployment.ValidationException: DeploymentScenario contains targets not maching any defined Container in the registry. _DEFAULT_

                  at org.jboss.arquillian.impl.client.deployment.DeploymentGenerator.validate(DeploymentGenerator.java:95)

                  at org.jboss.arquillian.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:77)

                  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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                  at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                  at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                  at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                  at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                  at org.jboss.arquillian.impl.core.EventImpl.fire(EventImpl.java:67)

                  at org.jboss.arquillian.impl.client.ContainerEventController.execute(ContainerEventController.java:68)

                  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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                  at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                  at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                  at org.jboss.arquillian.impl.TestContextHandler.createClassContext(TestContextHandler.java:68)

                  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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                  at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:87)

                  at org.jboss.arquillian.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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                  at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:87)

                  at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                  at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                  at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:70)

                  at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:170)

                  at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:303)

                  at org.jboss.arquillian.junit.Arquillian.access$300(Arquillian.java:45)

                  at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:187)

                  at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

                  at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:127)

                  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)

                  at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

               

               

              java.lang.NullPointerException

                  at org.jboss.arquillian.impl.client.container.ContainerDeployController.forEachManagedDeployment(ContainerDeployController.java:204)

                  at org.jboss.arquillian.impl.client.container.ContainerDeployController.undeployManaged(ContainerDeployController.java:99)

                  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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                  at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                  at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                  at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                  at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                  at org.jboss.arquillian.impl.core.EventImpl.fire(EventImpl.java:67)

                  at org.jboss.arquillian.impl.client.ContainerEventController.execute(ContainerEventController.java:74)

                  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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                  at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                  at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                  at org.jboss.arquillian.impl.TestContextHandler.createClassContext(TestContextHandler.java:68)

                  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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                  at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:87)

                  at org.jboss.arquillian.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.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                  at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:87)

                  at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                  at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                  at org.jboss.arquillian.impl.EventTestRunnerAdaptor.afterClass(EventTestRunnerAdaptor.java:77)

                  at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:192)

                  at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:303)

                  at org.jboss.arquillian.junit.Arquillian.access$300(Arquillian.java:45)

                  at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:187)

                  at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

                  at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:127)

                  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)

                  at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

               

               

               

              • 4. Re: Testing JBoss-app under Arquillian?
                marx3 Apprentice

                It doesn't seem like a proper configuration.

                Look at docs, here for example is managed config:

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

                 

                For remote there is no actual configuration in documentation, instead of deepchain use:

                 

                <profile>

                            <id>jbossas-remote-6</id>

                            <dependencies>

                                <dependency>

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

                                    <artifactId>arquillian-jbossas-remote-6</artifactId>

                                    <version>${arquillian.version}</version>

                                    <scope>test</scope>

                                </dependency>

                                <dependency>

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

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

                                    <version>6.0.0.Final</version>

                                    <type>pom</type>

                                </dependency>

                            </dependencies>

                        </profile>