title: Cometd dojo application - HTTP 408 with glassfish
body: <p>I configured and developped an intranet application that combines: spring 3.0.5 (including security) + CometD 2.3.1.</p>
  
  <p>In order to setup cometd, I referred to :
  <a href="http://docs.cometd.org/2.4.3/reference/#java_server_services_integration_spring" rel="nofollow">http://docs.cometd.org/2.4.3/reference/#java_server_services_integration_spring</a></p>
  
  <p>When I run my application in jetty, everything works fine. But when I try to run it in a glassfish v2, I'm "randomly" getting HTTP 408 . Error in server.log:</p>
  
  <pre><code>    [#|2012-11-02T15:43:50.428+0100|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=17;_ThreadName=httpSSLWorkerThread-9000-0;_RequestID=eb9ebc97-ac0f-48fe-8793-cfc9fd3e7b3a;|StandardWrapperValve[default]: PWC1406: Servlet.service() for servlet default threw exception
  java.lang.IllegalStateException
      at org.apache.coyote.tomcat5.CoyoteResponseFacade.sendError(CoyoteResponseFacade.java:433)
      at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:141)
      at org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper.sendError(SaveContextOnUpdateOrErrorResponseWrapper.java:54)
      at org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:740)
      at org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:384)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
      at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
      at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
      at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
  </code></pre>
  
  <p>And from the IE client perspective, my cometD connectivity is unstable:</p>
  
  <pre><code>13:16:16 - CometD Connection Established
  13:16:16 - CometD Connection Broken
  13:16:17 - CometD Connection Established
  13:16:17 - CometD Connection Broken
  13:16:20 - CometD Connection Established
  13:16:20 - CometD Connection Broken
  13:16:21 - CometD Connection Established
  13:16:21 - CometD Connection Broken
  13:16:22 - CometD Connection Established
  13:16:23 - CometD Connection Broken
  </code></pre>
  
  <p>but despite error message, the cometd connectivity works: subscribe actions are OK and notifications are succesfully received from the server.</p>
  
  <p>Nota: I deployed the sample dojo-chat application (that I took as a model) in the same glassfish domain and it's working fine!</p>
  
  <p>What could have I missed?</p>