ERR_CONTENT_LENGTH_MISMATCH while loading js files on tomcat server

chrome ignore err_content_length_mismatch
err_content_length_mismatch 2
failed to load resource content length mismatch
err_content_length_mismatch iis
error content-length mismatch
error err_content_length_mismatch
err_content_length_mismatch image
nginx net::err_content_length_mismatch 200 ok

Configuration:

  • OS: CntOS 6.5 minimal
  • Tomcat: 7.0.53
  • Deployed war file contains many .js and .css files

Issue: When the war file is deployed on tomcat, it gets exploded properly and the web portal works fine. Machine is idle for over 12 hours.

  • I access tomcat page: works fine. Even the manager page opens fine.
  • I launch my webportal, it does not load. Error: GET http://:8080/webportal/client/libs/jquery/jquery-ui-1.9.2.min.js net::ERR_CONTENT_LENGTH_MISMATCH 10.211.106.184/:63 I get this error for various other js files as well.

What i have tried:

  • Not an issue with memory since sufficient memory is available.
  • Tried to open the .js file in another tab, the page keeps loading for a long time and then stops loading. The file is not fully downloaded. Hence the content mismatch issue.
  • Access to the same url from the local CentOS box using wget works but access from browser on remote box does not
  • Once static file is accessed on appliance using vi editor (not saved only accessed), downloads from browser start working

Question:

  • What could possibly be an issue here? Is there any compatibility issue with tomcat and CentOS.
  • Note again that immediately after deployment everything works fine. Webportal does not work only after a few (>12 approx) hours of inactivity.

In conf/server.xml config file in apache tomcat folder set the "usesendfile" attribute to "false" as shown below:-

<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"  **useSendfile="false"**/>

Please refer to link: http://ci.apache.org/projects/tomcat/tomcat7/docs/config/http.html for more details.

ERR_CONTENT_LENGTH_MISMATCH while loading js files , ERR_CONTENT_LENGTH_MISMATCH while loading js files on tomcat server. Configuration: OS: CntOS 6.5 minimal Tomcat: 7.0.53 Deployed war file contains � Download file to tomcat server from URL. 0. ERR_CONTENT_LENGTH_MISMATCH while loading js files on tomcat server. 0. Tomcat: The requested resource is not

Since this is the first Google hit for the query "tomcat" net::ERR_CONTENT_LENGTH_MISMATCH, I'll share what I did in my case to solve the problem. For me, the jsp pages in the application loaded normally, but some CSS and JS files (e.g. jQuery) failed to load, exactly with this net::ERR_CONTENT_LENGTH_MISMATCH error.

This happened after I had set the timeout parameter of the Tomcat server to -1, as described here:

connectionTimeout The number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. Use a value of -1 to indicate no (i.e. infinite) timeout.

It's in the server.xml file in the conf folder. Setting this to another value (60000) solved the problem for me.

ERR_CONTENT_LENGTH_MISMATCH on nginx and proxy on , Angular failed to load resource: net::err_content_length_mismatch In conf/ server.xml config file in apache tomcat folder set the "usesendfile" attribute to " false" as shown below:- ERR_CONTENT_LENGTH_MISMATCH while loading js files� I've tried to correct in various ways with various solutions of the Internet, changing the server.xml tomcat, permission of files and folders and several other attempts without success. Could anyone help me? Thank's!

Try to deploy your webapp to Tomcat 6 or Tomcat 8, sometimes it works. I have solved such a issue but I don't know why. So you can have a try. Maybe it works. Good luck!

Javascript - ERR_CONTENT_LENGTH_MISMATCH, err_content_length_mismatch tomcat net::err_failed 200 ok net:: err_http2_protocol_error nginx net::err_http2_protocol_error 200 failed to load resource:� Please send me your system information - available either from the command line when calling the pre-built civetweb executable with the -I parameter, or (on Windows) from the context menu, or (if you build on your own) from the mg_get_system_info function.

Theme doesn't load when using Tomcat 9 � Issue #3871 � vaadin , It seems like it is not only the theme that fails to load. 26013015/err-content- length-mismatch-while-loading-js-files-on-tomcat-server suggests. Per the ERR_CONTENT_LENGTH_MISMATCH question, the Webpack Dev Server (and in my response here, Express explicitly) fails to send the full content of a JavaScript file to an external IP address. Using a CLI tool like wget , Webpack Dev Server shows it receives a 206 status code for Partial Content.

After Update: net::ERR_CONTENT_LENGTH_MISMATCH when , GET http://127.0.0.1:49776/system/jquery/dist/jquery.min.js net:: It's ok for the server to retry for a while, but finally it must close these connections The only message I get in the firefox console when loading a text file is, I did Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH when� I have a JavaScript file on my Tomcat 7 server. However, when I attempt to retrieve the file via HTTP GET, the response hangs and does not fully write the file to my client. It writes about 80% of the file to my client then the response seems to hang. I can't find anything in tomcat logs at this point.

Failed to load resource: net::ERR_CONNECTION_RESET, https://stackoverflow.com/questions/4390134/failed-to-load-resource-under- chrome/ directive disables some links, I had to make it exclusive for javascript files: I had similar problems when running a confluence instance (within a tomcat� Using Tomcat reload features to speed up development In compliance with a recommendation in Section 4 of the Java Servlet specification, Apache Tomcat implements methods of systematically reloading Java classes to allow an application's components to be updated without restarting the entire server.

Comments
  • Must be a content length limit/restriction in your web server settings.
  • Thanks Zee. However, the content length issue is because the loading of webpage stops before download of js file is complete. And this does work after the war is deployed. Only stops working if server is idle for 12 hours or more.
  • Thanks Kunal. Setting usesendfile=false would ensure that tomcat sends compressed responses and hence reducing the time required for transfer on slower networks. The has fixed the issue.
  • @DhavalMetrani I don't think your conclusion ist correct. Setting usesendfile=false turns off compression and thus save cpu time.
  • Thanks Glorfindel for the answer. It's been over 4 years since I posted this! Out of curiosity, does this work with any other timeout value? And did you have to wait for 12 hours before getting this error?
  • The timeout value used to be 20000 and that worked too. I'm not sure if I needed to wait for 12 hours, I think restarting Tomcat already applied the new timeout settings.