Arquillian
  1. Arquillian
  2. ARQ-658

Deployment of an EnterpriseArchive onto remote GlassFish fails, when the contextRoot recorded in GlassFish, does not start with a slash

    Details

    • Similar Issues:
      Show 10 results 

      Description

      if shrinkwrapping in the following way:

       
      @RunWith(Arquillian.class)
      public class ClientTest {
          ... 
          @Deployment
          public static EnterpriseArchive createTestArchive() {
          JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "test.jar").addClasses(Client.class)
              .addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
          EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
              .addAsModule(jar);
          return ear;
      }
      ...
      

      I get the following exception:

      -------------------------------------------------------------------------------
      Test set: TestSuite
      -------------------------------------------------------------------------------
      Tests run: 5, Failures: 1, Errors: 0, Skipped: 4, Time elapsed: 2.316 sec <<< FAILURE!
      arquillianBeforeClass(org.demo.ClientTest)  Time elapsed: 0 sec  <<< FAILURE!
      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
                at java.lang.String.substring(String.java:1952)
                at java.lang.String.substring(String.java:1925)
                at org.jboss.arquillian.container.glassfish.remote_3_1.clientutils.GlassFishClientService.resolveWebModuleContextRoot(GlassFishClientService.java:307)
                at org.jboss.arquillian.container.glassfish.remote_3_1.clientutils.GlassFishClientService.doDeploy(GlassFishClientService.java:229)
                at org.jboss.arquillian.container.glassfish.remote_3_1.GlassFishRestDeployableContainer.deploy(GlassFishRestDeployableContainer.java:123)
                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:148)
                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:115)
                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:258)
                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:114)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                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.container.DeploymentExceptionHandler.verifyExpectedExceptionDuringDeploy(DeploymentExceptionHandler.java:50)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                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.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:78)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                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.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                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.ContainerDeployController$1.perform(ContainerDeployController.java:86)
                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:79)
                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.java:250)
                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment(ContainerDeployController.java:226)
                at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployController.java:78)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                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:97)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                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.createClassContext(TestContextHandler.java:68)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                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.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:54)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                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.beforeClass(EventTestRunnerAdaptor.java:80)
                at org.jboss.arquillian.testng.Arquillian.arquillianBeforeClass(Arquillian.java:76)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:76)
                at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:525)
                at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)
                at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:130)
                at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:173)
                at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
                at org.testng.TestRunner.runWorkers(TestRunner.java:1147)
                at org.testng.TestRunner.privateRun(TestRunner.java:749)
                at org.testng.TestRunner.run(TestRunner.java:600)
                at org.testng.SuiteRunner.runTest(SuiteRunner.java:317)
                at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:312)
                at org.testng.SuiteRunner.privateRun(SuiteRunner.java:274)
                at org.testng.SuiteRunner.run(SuiteRunner.java:223)
                at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
                at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
                at org.testng.TestNG.runSuitesSequentially(TestNG.java:1039)
                at org.testng.TestNG.runSuitesLocally(TestNG.java:964)
                at org.testng.TestNG.run(TestNG.java:900)
                at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:60)
                at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:106)
                at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                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) 
      

        Activity

        Hide
        Vineet Reynolds
        added a comment - - edited

        Arquillian fails to resolve the context root of the deployment, as it is not specified in the application.xml file. This is a valid scenario, as an application.xml file is not a prerequisite for a deployment.

        Of importance here, is the format of the moduleInfo property of the REST resource for the list-sub-components Admin Command. The moduleInfo returned has the format - moduleArchiveURI:moduleType:contextRoot. The contextRoot may or may not start with a "/". Currently, the GlassFish extension expects a "/" (which may have been specified in the application.xml file), but as demonstrated by the testcase, this is not necessary and will be absent when the GlassFish container generates the context root itself.

        Show
        Vineet Reynolds
        added a comment - - edited Arquillian fails to resolve the context root of the deployment, as it is not specified in the application.xml file. This is a valid scenario, as an application.xml file is not a prerequisite for a deployment. Of importance here, is the format of the moduleInfo property of the REST resource for the list-sub-components Admin Command. The moduleInfo returned has the format - moduleArchiveURI:moduleType:contextRoot . The contextRoot may or may not start with a "/". Currently, the GlassFish extension expects a "/" (which may have been specified in the application.xml file), but as demonstrated by the testcase, this is not necessary and will be absent when the GlassFish container generates the context root itself.
        Hide
        Vineet Reynolds
        added a comment - - edited

        Corrected the logic to obtain the context root for a deployment.

        The GlassFish extension now parses the moduleInfo property assuming that it contains the contextRoot in the format - moduleArchiveURI:moduleType:contextRoot. This is of course, done only for servlet sub-components.

        Added a testcase that does not generate a deployment with an application.xml file. Not having this file, tends to get GlassFish to register the contextRoot for the module, without a slash.

        Show
        Vineet Reynolds
        added a comment - - edited Corrected the logic to obtain the context root for a deployment. The GlassFish extension now parses the moduleInfo property assuming that it contains the contextRoot in the format - moduleArchiveURI:moduleType:contextRoot. This is of course, done only for servlet sub-components. Added a testcase that does not generate a deployment with an application.xml file. Not having this file, tends to get GlassFish to register the contextRoot for the module, without a slash.
        Hide
        Aslak Knutsen
        added a comment -

        pushed upstream

        Show
        Aslak Knutsen
        added a comment - pushed upstream

          People

          • Assignee:
            Vineet Reynolds
            Reporter:
            Hanspeter Gisler
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: