Ivy deploy fails intermittently with "java.io.IOException: Error writing to server"

Visit my.sonatype.com for documentation on Nexus Repository version 2.


You're publishing artifacts to Nexus Repository 2 using Ivy, and it periodically fails with this error:


/Users/rseddon/temp/test/build.xml:41: impossible to publish artifacts for test#jdbc7; java.io.IOException: Error writing to server
at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:666)
at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:678)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at org.apache.ivy.util.url.BasicURLHandler.upload(BasicURLHandler.java:263)
at org.apache.ivy.util.url.URLHandlerDispatcher.upload(URLHandlerDispatcher.java:82)
at org.apache.ivy.util.FileUtil.copy(FileUtil.java:283)


This failure happens because a "TCP window full" message is sent, and then Nexus Repository 2/Jetty tries to negotiate a new TCP window size, but for some reason, the deployer won't accept anything sent.

As far as we can tell this is a bug in the JDK URL classes Ivy uses by default when publishing artifacts. The solution is to configure Ivy to use HttpClient for publishing.

To do this, put the following jars on the classpath in addition to the ivy.jar file:

  • commons-codec.jar
  • commons-httpclient.jar
  • commons-logging.jar

The specific versions of these needed can be found in the "bin-with-deps" download at the Ivy download site:  http://ant.apache.org/ivy/download.cgi

It's a good idea to do this for other reasons, you'll likely find that the default Sun/Oracle URL classes will be problematic in other ways, here is one example:



Have more questions? Submit a request


Article is closed for comments.