Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note
titleUnexpected end of file from server and maxIdleTime parameter

By default, Jetty sets the maxIdleTime parameter in the etc/jetty.xml file 30 seconds. This means that if the actual deployment takes more than 30 seconds, you might get error messages like:

Code Block
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.2.2:deploy (default-cli)
        on project display: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.2.2:deploy
        failed: Failed to deploy [/var/lib/jenkins/workspace/Vanessa-cargo/target/display-1.2.2.1-SNAPSHOT.war]:
        Unexpected end of file from server -> [Help 1]

    ...

Caused by: java.net.SocketException: Unexpected end of file from server
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:770)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:767)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1162)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:397)
    at org.codehaus.cargo.container.jetty.JettyRemoteDeployer.getResponseMessage(JettyRemoteDeployer.java:262)
    at org.codehaus.cargo.container.jetty.JettyRemoteDeployer.deploy(JettyRemoteDeployer.java:113)
    ... 25 more

In this case, open the target Jetty container's etc/jetty.xml file and set the maxIdleTime parameter to longer. For example:

Code Block
languagehtml/xml
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">

<Configure id="Server" class="org.mortbay.jetty.Server">
  <Call name="addConnector">
    <Arg>
      <New class="org.mortbay.jetty.nio.SelectChannelConnector">
        <!-- Set a longer maxIdleTime (90 seconds in this case) to allow long remote deployments -->
        <Set name="maxIdleTime">90000</Set>
      </New>
    </Arg>
  </Call>
</Configure>