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

Embedded GlassFish adapter may use an incorrect HTTP port when a custom domain configuration XML file is used

    Details

    • Steps to Reproduce:
      Hide

      Use domain.xml with the following listeners:

      ...
      <network-listener port="8080" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
      <network-listener port="8181" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener>
      ...
      

      Use an Arquillian configuration file like (where the above domain.xml file is present in ${instanceRoot}/config directory:

      ...
      <container qualifier="glassfish-31-embedded">
          <configuration>
              <property name="instanceRoot">/opt/glassfish3/glassfish/domains/domain1</property>
              <property name="installRoot">/opt/glassfish3/glassfish</property>
          </configuration>
      </container>
      ...
      

      Execute any in-container Arquillian test, and it fails.

      Show
      Use domain.xml with the following listeners: ... <network-listener port= "8080" protocol= "http-listener-1" transport= "tcp" name= "http-listener-1" thread-pool= "http-thread-pool" > </network-listener> <network-listener port= "8181" protocol= "http-listener-2" transport= "tcp" name= "http-listener-2" thread-pool= "http-thread-pool" > </network-listener> ... Use an Arquillian configuration file like (where the above domain.xml file is present in ${instanceRoot}/config directory: ... <container qualifier= "glassfish-31-embedded" > <configuration> <property name= "instanceRoot" > /opt/glassfish3/glassfish/domains/domain1 </property> <property name= "installRoot" > /opt/glassfish3/glassfish </property> </configuration> </container> ... Execute any in-container Arquillian test, and it fails.
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      As a workaround, use a domain.xml file where the HTTP listener port is registered to listen on 8181 (sigh). Change the HTTPS listener port to another one to avoid port conflict.

      Show
      As a workaround, use a domain.xml file where the HTTP listener port is registered to listen on 8181 (sigh). Change the HTTPS listener port to another one to avoid port conflict.

      Description

      The embedded GlassFish container uses the default HTTP bind port of 8181, even though the user-supplied domain configuration XML file may specify a different HTTP port. This results in the following exception being thrown when the Arquillian client attempts to execute a test:

      ...
      INFO: WELD-000900 SNAPSHOT
      9 Apr, 2012 11:06:12 AM com.sun.enterprise.web.WebApplication start
      INFO: WEB0671: Loading application [test] at [/test]
      9 Apr, 2012 11:06:13 AM org.glassfish.deployment.admin.DeployCommand execute
      INFO: test was successfully deployed in 18,014 milliseconds.
      java.net.SocketException: Unexpected end of file from server
      	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:769)
      	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
      	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:766)
      	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
      	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
      	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
      	at org.jboss.arquillian.protocol.servlet.ServletMethodExecutor.execute(ServletMethodExecutor.java:206)
      	at org.jboss.arquillian.protocol.servlet.ServletMethodExecutor.access$000(ServletMethodExecutor.java:43)
      	at org.jboss.arquillian.protocol.servlet.ServletMethodExecutor$1.run(ServletMethodExecutor.java:99)
      	at java.util.TimerThread.mainLoop(Timer.java:512)
      	at java.util.TimerThread.run(Timer.java:462)
      

      Note that the deployment is successful, but the HTTPContext returned by the embedded GlassFish adapter contains the wrong port information. In this case, the http-listener-1/http-listener-2 combo was registered in domain.xml to listen on 8080/8181. When Arquillian established a connection to port 8181, the container obviously did not respond to plain text HTTP traffic, and quite obviously the client errored out.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                vineet.reynolds Vineet Reynolds
                Reporter:
                vineet.reynolds Vineet Reynolds
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: