Created attachment 36290 [details] Test case reproducing the issue It appears that the bug https://bz.apache.org/bugzilla/show_bug.cgi?id=57887 has resurfaced in Tomcat 9. The test case from that bug fails in Tomcat 9 with the error stack trace: 04-Dec-2018 17:57:06.353 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.core.ApplicationContext.log Background compile failed java.lang.IllegalStateException: zip file closed at java.util.zip.ZipFile.ensureOpen(ZipFile.java:686) at java.util.zip.ZipFile.getEntry(ZipFile.java:315) at java.util.jar.JarFile.getEntry(JarFile.java:240) at org.apache.tomcat.util.scan.JarFileUrlJar.getLastModified(JarFileUrlJar.java:94) at org.apache.jasper.JspCompilationContext.getLastModified(JspCompilationContext.java:380) at org.apache.jasper.JspCompilationContext.getLastModified(JspCompilationContext.java:368) at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:480) at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:434) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:596) at org.apache.jasper.compiler.JspRuntimeContext.checkCompile(JspRuntimeContext.java:385) at org.apache.jasper.servlet.JspServlet.periodicEvent(JspServlet.java:357) at org.apache.catalina.core.StandardWrapper.backgroundProcess(StandardWrapper.java:623) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1398) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1402) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1402) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1402) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1370) at java.lang.Thread.run(Thread.java:748) This appears to be due to the .tag file in the JAR. I have inserted debugging into JarFileUrlJar and I can see that getLastModified is called successfully, close() is called, and then getLastModified is called again and fails as the zip is closed. I have attached the same test case hoping it's easier that getting it from that bug. Make a WAR from the WebContent directory and deploy. Load the web app. Wait a minute.
Note: To trigger this issue, development needs to be set to false and checkInterval set to a positive integer - 60 is a reasonable number in this instance.
Thanks for the report and for spotting the link to the previous issue. Very helpful. Fixed in: - trunk for 9.0.14 onwards - 8.5.x for 8.5.36 onwards
Mark, thank you very much. Love your work.