When the application is deployed as "unpackWAR=false", sometimes I try to download a js file which is over than 2MB, ERR_CONTENT_LENGTH_MISMATCH will be thrown on the front end, I use Chrome. I checked accesslog and found the file's content length is less than it is when the exception thrown. Here's the stacktrace I found in the log file: java.io.IOException: Stream closed at java.util.zip.InflaterInputStream.ensureOpen(InflaterInputStream.java:67) at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:142) at org.apache.catalina.webresources.AbstractArchiveResource$JarInputStreamWrapper.read(AbstractArchiveResource.java:255) at java.io.BufferedInputStream.read1(BufferedInputStream.java:273) at java.io.BufferedInputStream.read(BufferedInputStream.java:334) at java.io.FilterInputStream.read(FilterInputStream.java:107) at org.apache.catalina.servlets.DefaultServlet.copyRange(DefaultServlet.java:2125) at org.apache.catalina.servlets.DefaultServlet.copy(DefaultServlet.java:1971) at org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:968) at org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:398)
Hi, Can you test with the latest Tomcat 8 version (8.0.39)? Can you provide a simple example that reproduces the issue? Do you see this problem with other browsers? Thanks, Violeta
I usually take about 5-10s to download the js file, and the more time it took, the easier the error occured. I cannot deploy on tomcat 8.0.39, here's the error log, do you have any idea? org.apache.catalina.startup.ContextConfig.processServletContainerInitializers Failed to detect ServletContainerInitializers for context with name [/imsp] java.io.FileNotFoundException: JAR entry !/META-INF/services/javax.servlet.ServletContainerInitializer not found in D:\apache-tomcat-8.0.39\temp\jar_cache4125440539893731259.tmp at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:140) at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:150) at java.net.URL.openStream(URL.java:1037) at org.apache.catalina.startup.WebappServiceLoader.parseConfigFile(WebappServiceLoader.java:162) at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:136) at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1631) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1140) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:783) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:307) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5213) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:940) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1816) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744)
I only changed unpackWARs to false in server.xml. <Host name="localhost" appBase="webapps" unpackWARs="false" autoDeploy="true">
I debuged, spring-web-4.2.5.RELEASE.jar is in our app. so tomcat cannot load /META-INF/services/javax.servlet.ServletContainerInitializer from the jar file when unpackWAR=false
I've fixed the issue that prevents SCIs from being processed with 8.0.39. The fix will be in 8.0.40 onwards. You'll need to build 8.0.x from source (not as difficuly as you might think) to test it. I'm still looking for possible causes of the original problem.
I've found the likely cause. If close is called multiple times on a JarInputStreamWrapper then it is possible that this error could occur. I should have a fix for this shortly.
Fixed in: - trunk for 9.0.0.M14 onwards - 8.5.x for 8.5.9 onwards - 8.0.x for 8.0.40 onwards 7.0.x and earlier was not affected.
When will it be released?
Is there any workaround if using Tomcat 8.0.39 and unpackWars=false?