For the past year or so, much of the work I've done with Java has used Maven's Shade plugin. This plugin does a really excellent job of mashing dozens to hundreds of Java dependencies into a single jar file. This not only makes deployment easier, but for things like Hadoop jobs makes dependency management in general much easier.
The issue in this case only appeared in the production environment but not in test and not when running from my IDE under a debugger. The core service would start fine, but on any request, the code streaming data would throw an exception similar to:
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:240)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:593)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:514)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:505)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>com.sun.jersey:jersey-server</artifact>
<excludes>
<exclude>META-INF/services/javax.ws.rs.ext.MessageBodyWriter</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>