2 Replies Latest reply on Nov 12, 2008 10:00 AM by Thomas Fossman

    some times "No phase id bound to current thread" happens from my servlet.

    Thomas Fossman Newbie
      Hello, I have a simple servlet that is loading data from the hard drive and outputing it to the client.
      "No phase id bound to current thread (make sure you do not have two SeamPhaseListener instances installed" happens about 5% of all times this servlet is called.


      Using Components.getInstance() with seam context filter enabled this is how it looks:


      2008-11-11 11:35:28,107 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/].[ServeMediaServlet]] Servlet.service() for servlet ServeMediaServlet threw exception
      java.lang.IllegalStateException: No phase id bound to current thread (make sure you do not have two SeamPhaseListener instances installed)
           at org.jboss.seam.contexts.PageContext.getPhaseId(PageContext.java:162)
           at org.jboss.seam.contexts.PageContext.isBeforeInvokeApplicationPhase(PageContext.java:174)
           at org.jboss.seam.contexts.PageContext.getCurrentWritableMap(PageContext.java:90)
           at org.jboss.seam.contexts.PageContext.remove(PageContext.java:104)
           at org.jboss.seam.Component.newInstance(Component.java:2063)
           at org.jboss.seam.Component.getInstance(Component.java:1948)
           at org.jboss.seam.Component.getInstance(Component.java:1927)
           at org.jboss.seam.Component.getInstance(Component.java:1921)
           at org.jboss.seam.Component.getInstance(Component.java:1894)
           at org.jboss.seam.Component.getInstance(Component.java:1889)
           at org.jboss.seam.faces.FacesPage.instance(FacesPage.java:92)
           at org.jboss.seam.core.ConversationPropagation.restorePageContextConversationId(ConversationPropagation.java:84)
           at org.jboss.seam.core.ConversationPropagation.restoreConversationId(ConversationPropagation.java:57)
           at org.jboss.seam.servlet.ContextualHttpServletRequest.restoreConversationId(ContextualHttpServletRequest.java:89)
           at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:40)
           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:177)
           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
           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.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           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:432)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
           at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:366)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           at java.lang.Thread.run(Thread.java:619)
      ...

      Does the page context exist when the request does not originate from a jsf request? I do not make any direct or indirect invocations to any page scoped components from my servlet (from what I can see).


      Then I went on testing disabling the context filter to use jndi lookup to see If I could get around the problem. That didn't work either, instead I got a new error (tomcat problem?):


      2008-11-11 16:27:31,388 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/].[ServeMediaServlet]] Servlet.service() for servlet ServeMediaServlet threw exception
      java.lang.NullPointerException
              at org.apache.catalina.connector.Request.removeAttribute(Request.java:1354)
              at org.apache.catalina.connector.RequestFacade.removeAttribute(RequestFacade.java:514)
              at org.apache.catalina.core.ApplicationHttpRequest.removeAttribute(ApplicationHttpRequest.java:256)
              at com.sun.faces.context.RequestMap.remove(ExternalContextImpl.java:1110)
              at org.jboss.seam.contexts.BasicContext.remove(BasicContext.java:74)
              at org.jboss.seam.Component.newInstance(Component.java:2102)
              at org.jboss.seam.Component.getInstance(Component.java:1987)
              at org.jboss.seam.Component.getInstance(Component.java:1966)
              at org.jboss.seam.Component.getInstance(Component.java:1960)
              at org.jboss.seam.Component.getInstance(Component.java:1933)
              at org.jboss.seam.Component.getInstance(Component.java:1928)
              at org.jboss.seam.core.Events.instance(Events.java:157)
              at org.jboss.seam.core.Events.exists(Events.java:152)
              at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:236)
              at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:394)
              at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:136)
              at org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:89)
              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:164)
              at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
              at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
              at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:406)
              at com.yourstardom.integration.WikiUrlRewriteFilter.doFilter(WikiUrlRewriteFilter.java:65)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
              at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
              at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
              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.servlet.SeamFilter.doFilter(SeamFilter.java:158)
              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:432)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
              at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
              at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:366)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              at java.lang.Thread.run(Thread.java:619)


      tested on the following configurations:
      jdk160u10 64bit, soalris 10, sparc, jboss 4.2.2, jsf1.2.10
      jdk160u10 64bit, ubuntu 8.10, x64, jboss 4.2.3, jsf1.2 9 & 10