0 Replies Latest reply on May 29, 2015 10:36 AM by Thomas Kriechbaum

    How to define resource references with ShrinkWrap (Arquillian and Wildfly 8.2)

    Thomas Kriechbaum Newbie

      Hello,

       

      I'm testing portable JNDI naming with Arquillian and Wildfly 8.2 (managed container integration).

       

      The following web.xml and standalone.xml configuration works if I build a WAR and deploy it afterwards

      <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
      
          <resource-ref>
              <res-ref-name>java:app/env/url/configuration</res-ref-name>
              <res-type>java.net.URL</res-type>
              <res-auth>Container</res-auth>
              <lookup-name>java:global/wildfly-services/env/url/configuration</lookup-name>
          </resource-ref>
      </web-app>
      



      <subsystem xmlns="urn:jboss:domain:naming:2.0">
         <bindings>
              <simple name="java:global/wildfly-services/env/url/configuration" value="file:///data/config/wildfly-services-1.0" type="java.net.URL"/>
          </bindings>
          <remote-naming/>
      </subsystem>
      

       

       

      How do I have to define the obove resource reference definition with ShrinkWrap?

       

      The following Deployment causes an exception

       

       

      @Deployment
          public static Archive<?> createDeployment() throws Exception {
              WebAppDescriptor web = Descriptors.create(WebAppDescriptor.class);
              web.createResourceRef().resRefName("java:app/env/url/configuration")
                      .resType("java.net.URL")
                      .lookupName("java:global/wildfly-services/env/url/configuration")
                      .resAuth(ResAuthType._CONTAINER);
      
              return ShrinkWrap.create(WebArchive.class, "wildfly-services.war").addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
                      .addAsWebInfResource(new StringAsset(web.exportAsString()), "web.xml")
                      .addClasses(ConfigurationLookup.class);
          }
      

       

       

      Log/Exception:

      16:22:52,191 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "wildfly-services.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.app.wildfly-services.env.url.configuration is missing [jboss.naming.context.java.global.wildfly-services.env.url.configuration]"]}

      16:22:52,193 ERROR [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "wildfly-services.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.app.wildfly-services.env.url.configuration is missing [jboss.naming.context.java.global.wildfly-services.env.url.configuration]"]}

       

       

      org.jboss.arquillian.container.spi.client.container.DeploymentException: Cannot deploy: wildfly-services.war

          at org.jboss.as.arquillian.container.ArchiveDeployer.deployInternal(ArchiveDeployer.java:83)

          at org.jboss.as.arquillian.container.ArchiveDeployer.deployInternal(ArchiveDeployer.java:64)

          at org.jboss.as.arquillian.container.ArchiveDeployer.deploy(ArchiveDeployer.java:46)

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

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

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          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.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:78)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

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

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

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

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

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

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

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

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

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

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

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

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

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

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

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

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

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

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

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

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

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

          at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54)

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

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

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

          at org.junit.runner.JUnitCore.run(JUnitCore.java:160)

          at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)

          at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)

          at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

          at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

      Caused by: java.lang.Exception: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.app.wildfly-services.env.url.configuration is missing [jboss.naming.context.java.global.wildfly-services.env.url.configuration]"]}

          at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getActionResult(ServerDeploymentPlanResultFuture.java:134)

          at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getResultFromNode(ServerDeploymentPlanResultFuture.java:123)

          at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:85)

          at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:42)

          at org.jboss.as.controller.client.helpers.standalone.ServerDeploymentHelper.deploy(ServerDeploymentHelper.java:55)

          at org.jboss.as.arquillian.container.ArchiveDeployer.deployInternal(ArchiveDeployer.java:77)

          ... 93 more