my JSF web app is giving randomly error: \"zip file closed\" when accessing files (like images, css, js). It is deployed on Jetty 7. It looks like some of those files are no
This issue has been fixed in jetty-7.6.0.RC2. The bug is caused by the JVM caching jar url connection streams.
According to the bug report, you will need to also add the following to the jetty.xml:
<Set class="org.eclipse.jetty.util.resource.Resource" name="defaultUseCaches">false</Set>
I had the same issue and managed to solve it by going to etc\webdefault.xml
and changing this param to false
:
<init-param>
<param-name>gzip</param-name>
<param-value>true</param-value>
</init-param>
Jetty looks for your resources in the jar files in WEB-INF/lib. When it searches jsf-impl.jar it is somehow closed, probably by a JSF request. Perhaps jsf does its own resource handling and messes about with the files itself.
Anyway, the solution seems to be to move the jsf jars out of the war-file. Set your jsf dependency scope to provided so maven does not package them in the war file, and get them on the server, probably in the lib folder in jetty standalone.