2 Replies Latest reply on Nov 18, 2011 3:17 AM by Hanspeter Gisler

    if shrinkwrapping to an ear: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

    Hanspeter Gisler Newbie

      Hi,

       

      Does shrinkwrapping to an ear archive work for you folks? If yes, can somebody open by eyes and tell me, what I am doing wrong?

      Shrinkwrapping a class to an ear gives me an exception (war and jar work flawlessly).

       

      If a shrinkwrap in the following way:

       

      {code}public class ClientTest extends Arquillian {

          ...

          @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;

      }

      ...{code}

       

      I get the following exception:

       

      {code}

      -------------------------------------------------------------------------------

      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) {code}

       

      My setup / pom is as follows (also described in this post: http://community.jboss.org/thread/174948?tstart=0):

       

      My environment: maven 3, glassfish 3.1, netbeans 7, testng, arquillian, arquillian-resolver

       

      My pom:

       

      {code:xml}

          ...

       

          <properties>

              <org.jboss.shrinkwrap.resolver.version>1.1.0-alpha-1</org.jboss.shrinkwrap.resolver.version>

          </properties>

       

         <prerequisites>

              <maven>3.0.3</maven>

          </prerequisites>

       

          <profiles>

              <profile>

                  <id>glassfish-remote-3.1</id>

                  <dependencies>

                      <dependency>

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

                          <artifactId>arquillian-glassfish-remote-3.1</artifactId>

                          <version>1.0.0.CR2</version>

                          <scope>test</scope>

                      </dependency>

                  </dependencies>

                  <build>

                      <testResources>

                          <testResource>

                              <directory>src/test/resources</directory>

                          </testResource>

                      </testResources>

                  </build>

              </profile>

          </profiles>

       

          <dependencies>

              <dependency>

                  <groupId>org.testng</groupId>

                  <artifactId>testng</artifactId>

                  <version>6.3</version>

                  <scope>test</scope>

              </dependency>

       

              <!-- attention!! separate guice is needed by testng version >= 6.0 -->

              <dependency>

                  <groupId>com.google.inject</groupId>

                  <artifactId>guice</artifactId>

                  <version>3.0</version>

                  <scope>test</scope>

              </dependency>

       

              <dependency>

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

                  <artifactId>arquillian-testng-container</artifactId>

                  <version>1.0.0.CR5</version>

                  <scope>test</scope>

              </dependency>

       

              <!-- shrinkwrap resolver -->

              <dependency>

                  <groupId>org.jboss.shrinkwrap.resolver</groupId>

                  <artifactId>shrinkwrap-resolver-api</artifactId>

                  <version>${org.jboss.shrinkwrap.resolver.version}</version>

                  <scope>test</scope>

              </dependency>

              <dependency>

                  <groupId>org.jboss.shrinkwrap.resolver</groupId>

                  <artifactId>shrinkwrap-resolver-api-maven</artifactId>

                  <version>${org.jboss.shrinkwrap.resolver.version}</version>

                  <scope>test</scope>

              </dependency>

              <dependency>

                  <groupId>org.jboss.shrinkwrap.resolver</groupId>

                  <artifactId>shrinkwrap-resolver-impl-maven</artifactId>

                  <version>${org.jboss.shrinkwrap.resolver.version}</version>

                  <scope>test</scope>

              </dependency>

          </dependencies>

       

          ...{code}