2 Replies Latest reply on Apr 9, 2013 3:04 PM by Ian Hlavats

    Unable to test EAR with Arquillian in JBoss 7.1.1 remote

    Ian Hlavats Newbie

      Hello,

       

      I am trying to test an EAR file produced by our Maven build in a remote JBoss 7.1.1 container, so far without success, and would appreciate some help.

       

      Here is my JUnit test deployment method:

       

      {code}

                @Deployment

                public static EnterpriseArchive createDeployment() {

       

                     // get the ear

                     File earFile = new File("my-application.ear");

                     EnterpriseArchive archive = ShrinkWrap.createFromZipFile(EnterpriseArchive.class, earFile);

       

                     // add the test case to the webapp

                     WebArchive testWar = archive.getAsType(WebArchive.class, "/my-webapp.war");

                     testWar.addClass(MyTest.class);

       

                     // print the archive

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

                     return archive;

                }

      {code}

       

      Here is my arquillian.xml:

       

       

      {code}<?xml version="1.0" encoding="UTF-8"?>

      <arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xmlns="http://jboss.org/schema/arquillian"

          xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

       

                <defaultProtocol type="Servlet 3.0" />

                <container qualifier="jbossas-remote" default="true">

                          <configuration>

                                    <property name="managementAddress">127.0.0.1</property>

                                    <property name="managementPort">9999</property>

                                    <property name="username">username</property>

                                    <property name="password">password</property>

                          </configuration>

                </container>

       

      </arquillian>{code}

       

       

      When I run the unit test, Arquillian deploys my application to JBoss just fine. I can see the deployment was successful.

       

      However, before my test is executed I see the following stack trace:

       

       

      {code}

      java.lang.RuntimeException: org.jboss.as.arquillian.container.ManagementClient$UnSuccessfulOperationException: undefined

                at org.jboss.as.arquillian.container.ManagementClient.getWebUri(ManagementClient.java:108)

                at org.jboss.as.arquillian.container.ManagementClient.getDeploymentMetaData(ManagementClient.java:117)

                at org.jboss.as.arquillian.container.CommonDeployableContainer.deploy(CommonDeployableContainer.java:150)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:161)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:128)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:271)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:127)

                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:94)

                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.container.DeploymentExceptionHandler.verifyExpectedExceptionDuringDeploy(DeploymentExceptionHandler.java:50)

                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:94)

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

                at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:78)

                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:94)

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

                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:94)

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

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

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

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

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:95)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:80)

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.java:263)

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

                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployController.java:79)

                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:94)

                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:135)

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

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

                at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:101)

                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:94)

                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.createClassContext(TestContextHandler.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:94)

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

                at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)

                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:94)

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

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

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

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

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

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

                at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

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

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

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

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

                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)

      Caused by: org.jboss.as.arquillian.container.ManagementClient$UnSuccessfulOperationException: undefined

                at org.jboss.as.arquillian.container.ManagementClient.checkSuccessful(ManagementClient.java:317)

                at org.jboss.as.arquillian.container.ManagementClient.executeForResult(ManagementClient.java:310)

                at org.jboss.as.arquillian.container.ManagementClient.readResource(ManagementClient.java:305)

                at org.jboss.as.arquillian.container.ManagementClient.readRootNode(ManagementClient.java:188)

                at org.jboss.as.arquillian.container.ManagementClient.getWebUri(ManagementClient.java:105)

                ... 89 more

      {code}

       

      Here is part of my Maven pom.xml:

       

       

      {code}

        <dependencyManagement>

          <dependencies>

            <dependency>

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

              <artifactId>arquillian-bom</artifactId>

              <version>1.0.3.Final</version>

              <type>pom</type>

              <scope>import</scope>

            </dependency>

            <dependency>

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

              <artifactId>arquillian-drone-bom</artifactId>

              <version>1.1.1.Final</version>

              <type>pom</type>

              <scope>import</scope>

            </dependency>

          </dependencies>

        </dependencyManagement>

       

          <profile>

            <id>arquillian-jbossas-remote</id>

            <dependencies>

              <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>org.jboss.as</groupId>

                <artifactId>jboss-as-arquillian-container-remote</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>

          </profile>

       

      {code}

       

       

       

      I have seen some discussion in this forum about users successfully deploying and testing an ear file with Arquillian so I believe it is possible.

       

      Any advice you can share will be appreciated!

       

      Many thanks,

      Ian

        • 1. Re: Unable to test EAR with Arquillian in JBoss 7.1.1 remote
          Ian Hlavats Newbie

          I ran my test with TRACE level logging on the server side:

           

          {code}<logger category="org.jboss.as.controller.management-operation">

            <level name="TRACE" />

          </logger>{code}

           

          There was some issue in the log file:

           

          {code}19:52:44,593 DEBUG [org.jboss.as.controller.management-operation:404] (management-handler-thread - 6) JBAS014616: Operation ("read-resource") failed - address: ([

              ("deployment" => "my-application.ear"),

              ("subsystem" => "jpa"),

              ("hibernate-persistence-unit" => "my-application.ear#myPersistenceUnit"),

              ("entity-cache" => "spi.UpdateTimestampsCache")

          ]) - failure description: "JBAS014807: Management resource '[

              (\"deployment\" => \"my-application.ear\"),

              (\"subsystem\" => \"jpa\"),

              (\"hibernate-persistence-unit\" => \"my-application.ear#myPersistenceUnit\"),

              (\"entity-cache\" => \"spi.UpdateTimestampsCache\")

          ]' not found"{code}

           

          It is causing an exception when Arquillian is running my test.

           

          org.jboss.as.arquillian.container.ManagementClient.readRootNode() returns null and this causes getWebUri() to throw a RuntimeException, which causes the test to fail.

           

          Anyone have any idea what this error could mean and how I could fix it?

           

          Is there some configuration issue with my application?

          • 2. Re: Unable to test EAR with Arquillian in JBoss 7.1.1 remote
            Ian Hlavats Newbie

            An update:

             

            I deployed my application and used jboss-cli.sh to verify the persistence unit.

             

            It seems that the entity-cache was incorrectly configured or deployed, so I disabled Hibernate 2nd level cache in persistence.xml:

             

            {code}<property name="hibernate.cache.use_query_cache" value="false" />

            <property name="hibernate.cache.use_second_level_cache" value="false" />{code}

             

            Now the readRootNode() method is able to get the data from JBoss and I am able to proceed with my testing.

            1 of 1 people found this helpful