title: Tomcat 8.0.30 + Spring web Application - Error parsing HTTP request header
body: <p>Web application developed using Spring (4.0.9) deployed on tomcat (8.0.30), the application runs on two nodes and load balanced using F5. </p>
  
  <p>In production equivalent environment the application is working as expected.</p>
  
  <p>But in our production environment, we noticed that one point of time the application was not rendering the  either CSS or JS file consistently. We use requirejs to resolve modular dependency. </p>
  
  <p>This happens in both IE 11 and Mozilla.</p>
  
  <pre><code>SCRIPT5022: Script error for: jquery-ui
  http://requirejs.org/docs/errors.html#scripterror
  </code></pre>
  
  <p>In Spring we are handling the exception globally using @controlleradvice anotation at class level and  </p>
  
  <pre><code>@ExceptionHandler(Exception.class)
  public ModelAndView handleException(Exception exe,HttpServletRequest request){
  //some logger to print the request.getRequestURL()
  }
  </code></pre>
  
  <p>when there are issues the request.getRequestURL() returns a null pointer exception in the logger.</p>
  
  <p>we are clueless, and we are sure there is no issues in the database. 
  Would there be any port issue? any help on this is appreciated. </p>
  
  <p>Latest update :1 </p>
  
  <p>After we restarted the application the issue went away, but after quit sometime the same issue popped up, the log message has </p>
  
  <pre><code>30-May-2016 19:00:28.392 INFO [http-nio-portNum-exec-4] org.apache.coyote.http11.AbstractHttp11Processor.process Error parsing HTTP request header
   Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
   java.lang.IllegalStateException: Unexpected state: headers already parsed. Buffer not recycled?
  </code></pre>
  
  <p>Upon further request we are seeing that the js or CSS are not getting loaded in browser correctly. </p>
  
  <p>we use to get the below message after that in the log</p>
  
  <pre><code>org.apache.coyote.http11.AbstractHttp11Processor.endRequest Error finishing response
   java.lang.NullPointerException
      at org.apache.coyote.http11.InternalNioOutputBuffer.flushBuffer(InternalNioOutputBuffer.java:234)
  </code></pre>
  
  <p>Any help here would be helpful.</p>