2 Replies Latest reply on Jan 18, 2008 3:53 AM by mars1412

    no-connection servlet issue

    mars1412 Apprentice

      NOT URGENT

      I have a (third party) java applet, that connects to my servlet sending following request when it is initialized:

      HEAD /twentyfouract//servlets/multiupload HTTP/1.1
      Host: localhost
      Connection: close


      this works fine and returns what I expect (I implemented only doPost):
      HTTP/1.1 405 HTTP method GET is not supported by this URL


      but since I need some seam components in my servlet, I activate the seam web context filter, in my components.xml as described in http://docs.jboss.com/seam/latest/reference/en/html/configuration.html#d0e13654:
      <web:context-filter url-pattern="/servlets/*" />


      when I activate this context filter, the request above will always cause the following exception on the server:
      15:10:16,631 ERROR [[multiupload]] Servlet.service() for servlet multiupload threw exception
      java.lang.IllegalStateException: Cannot create a session after the response has been committed
       at org.apache.catalina.connector.Request.doGetSession(Request.java:2284)
       at org.apache.catalina.connector.Request.getSession(Request.java:2066)
       at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
       at org.jboss.seam.servlet.ServletRequestSessionMap.put(ServletRequestSessionMap.java:87)
       at org.jboss.seam.servlet.ServletRequestSessionMap.put(ServletRequestSessionMap.java:25)
       at org.jboss.seam.contexts.BasicContext.set(BasicContext.java:80)
       at org.jboss.seam.Component.newInstance(Component.java:1980)
       at org.jboss.seam.Component.getInstance(Component.java:1878)
       at org.jboss.seam.Component.getInstance(Component.java:1857)
       at org.jboss.seam.Component.getInstance(Component.java:1834)
       at org.jboss.seam.web.Session.getInstance(Session.java:122)
       at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:375)
       at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:132)
       at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:65)
       at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:619)
      


      note: this is not urgent - the applet and the servlet (doPost()) work correctly
      I just think, that this behaviour might indicate a (minor) bug in the filter, so maybe anyone of the SEAM team might check this

      for SEAM users, who might be interested in getting rid of this exception, here is what I did:
      I simply implemented the doGet method and return a plain/text:
      then my applet still works, and my servlet does not throw this exception anymore