Tomcat 8 does not respond to static content

When deploying our application (Java, Spring) on ​​Tomcat 7, this is normal. Now that we have upgraded to Tomcat 8 , it is very slow when serving static content. Considering the developer tools (see the screenshot below), each request for static content (small .js and .css files) requires as much as we configured for connectionTimeout in server.xml. Since the default value is 20,000, it may take 20 seconds. for each file. When dropped to 1000, it will be faster and take 1 second. for each.

This happens on different development machines using default configurations. Other processes (web service requests, etc.) are working fine.

I wonder what and where to start looking.

Developer Tools Snapshot

+4
3

, (pjl-comp-filter), CompressionFilter, Tomcat 8 Github ziplet ( ): https://github.com/ziplet/ziplet/issues/6

, :

( GZIP- )?

, , Tomcat 8, :

pom.xml:

    <dependency>
        <groupId>org.sourceforge</groupId>
        <artifactId>pjl-comp-filter</artifactId>
    </dependency>

web.xml:

<filter>
    <filter-name>CompressingFilter</filter-name>
    <filter-class>com.planetj.servlet.filter.compression.CompressingFilter</filter-class>
    <init-param>
        <param-name>includeContentTypes</param-name>
        <param-value>text/html,multipart/form-data,text/css,application/x-javascript</param-value>
    </init-param>
    <init-param>
        <param-name>compressionThreshold</param-name>
        <param-value>256</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>CompressingFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
+3

issue Ziplet - servlet spec 3.1 ( setContentLengthLong).

, .

18 2016 (ziplet-2.1.0)

+4

In my case, I just remove the compression filter from web.xml and everything returns to its normal state.

The below xml does not work with tomcat 8, at least in my application.

<filter>
    <filter-name>compressionFilter</filter-name>
    <filter-class>com.googlecode.webutilities.filters.CompressionFilter</filter-class>
    <init-param> 
        <param-name>compressionThreshold</param-name>
        <param-value>1024</param-value>
    </init-param>
    <init-param> 
        <param-name>ignoreURLPattern</param-name>
        <param-value>.*\.(flv|mp3|mpg)</param-value>
    </init-param>
    <init-param> 
        <param-name>ignoreMimes</param-name>
        <param-value>images/*,video/*, multipart/x-gzip</param-value>
    </init-param>
    <init-param> 
        <param-name>ignoreUserAgentsPattern</param-name>
        <param-value>.*MSIE.*</param-value>
    </init-param>
 </filter>
 <filter-mapping>
    <filter-name>compressionFilter</filter-name>
    <url-pattern>*</url-pattern>
 </filter-mapping> 
0
source

Source: https://habr.com/ru/post/1612296/


All Articles