Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-554

Servlet creates invalid URIs for root context

    XMLWordPrintable

    Details

      Description

      org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet.getBaseURI() and getFullURI() return invalid URIs for webapps deployed to the server's root context (e.g. ROOT.war for Tomcat).

      For the root context Servlet currently returns e.g. "http://localhost:8888//", which violates the BNF for the HTTP scheme per RFC1738:

      java.lang.RuntimeException: org.apache.http.client.ClientProtocolException
      	at net.sourceforge.jwebunit.htmlunit.HtmlUnitTestingEngineImpl.gotoPage(HtmlUnitTestingEngineImpl.java:263)
      	at net.sourceforge.jwebunit.htmlunit.HtmlUnitTestingEngineImpl.beginAt(HtmlUnitTestingEngineImpl.java:212)
      	at net.sourceforge.jwebunit.junit.WebTester.beginAt(WebTester.java:228)
      	at com.company.components.user.ui.LoginIT.shouldGetLoginPageForContextRootRequestWithNoCookies(LoginIT.java:58)
      	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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
      	at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:246)
      	at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.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: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.execution.ClientTestExecuter.execute(ClientTestExecuter.java:53)
      	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: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.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:130)
      	at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createTestContext(ContainerEventController.java:117)
      	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:90)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:82)
      	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:90)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	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: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: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: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: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.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)
      	at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:239)
      	at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:202)
      	at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290)
      	at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:45)
      	at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:216)
      	at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
      	at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:161)
      	at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:290)
      	at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:45)
      	at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:175)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
      	at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:123)
      	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)
      Caused by: org.apache.http.client.ClientProtocolException
      	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:643)
      	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:597)
      	at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:133)
      	at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1405)
      	at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1324)
      	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:303)
      	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:369)
      	at net.sourceforge.jwebunit.htmlunit.HtmlUnitTestingEngineImpl.gotoPage(HtmlUnitTestingEngineImpl.java:253)
      	... 86 more
      Caused by: org.apache.http.ProtocolException: Invalid URI: http://localhost:8888//
      	at org.apache.http.impl.client.DefaultRequestDirector.rewriteRequestURI(DefaultRequestDirector.java:339)
      	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:434)
      	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
      	... 93 more
      Caused by: java.net.URISyntaxException: Expected authority at index 2: //
      	at java.net.URI$Parser.fail(URI.java:2809)
      	at java.net.URI$Parser.failExpecting(URI.java:2815)
      	at java.net.URI$Parser.parseHierarchical(URI.java:3063)
      	at java.net.URI$Parser.parse(URI.java:3024)
      	at java.net.URI.<init>(URI.java:578)
      	at org.apache.http.client.utils.URIUtils.createURI(URIUtils.java:106)
      	at org.apache.http.client.utils.URIUtils.rewriteURI(URIUtils.java:141)
      	at org.apache.http.client.utils.URIUtils.rewriteURI(URIUtils.java:159)
      	at org.apache.http.impl.client.DefaultRequestDirector.rewriteRequestURI(DefaultRequestDirector.java:333)
      	... 95 more
      

        Attachments

          Activity

            People

            Assignee:
            ianbrandt Ian Brandt (Inactive)
            Reporter:
            ianbrandt Ian Brandt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: