Jetty - java.lang.IllegalStateException: zip file closed

There are 2 main causes for this.

  1. A bad/corrupt JAR file in your classpath.
  2. The JVM built-in URL caching getting in the way.

For a bad/corrupt JAR file, you'll have to isolate that on your own, figure out which one it is. Maybe by just unjaring all of them one by one till you find the problematic one.

As for the JVM URL caching, this seems to cause problems with dynamic classloaders like OSGi or hot-deploy scenarios the most.

For this scenario, you can tell jetty to set the URLConnection.setUseCaches(boolean) for each URLConnection attempt of its own.

To disable the JVM caches, add the following snippet of XML to your etc/jetty.xml

<Set class="org.eclipse.jetty.util.resource.Resource"
     name="defaultUseCaches">false</Set>

Tags:

Jetty