7 Replies Latest reply on Mar 8, 2007 12:53 PM by Igor Shabalov

    No phase id bound to current thread

    Scott Olcott Newbie

      I get the following error after upgrading from 1.0.6 to 1.1.0. I am using Seam/Trinidad/Ajax4jsf. Everything worked fine before upgrading.

      15:50:11,874 ERROR [ExceptionFilter] uncaught 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:153)
       at org.jboss.seam.contexts.PageContext.isRenderResponsePhase(PageContext.java:165)
       at org.jboss.seam.contexts.PageContext.getCurrentReadableMap(PageContext.java:76)
       at org.jboss.seam.contexts.PageContext.get(PageContext.java:66)
       at org.jboss.seam.contexts.Contexts.lookupInStatefulContexts(Contexts.java:160)
       at org.jboss.seam.Component.getInstance(Component.java:1577)
       at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:53)
       at org.ajax4jsf.framework.ajax.AjaxContext.getCurrentInstance(AjaxContext.java:150)
       at org.ajax4jsf.framework.renderer.AjaxPhaseListener.afterPhase(AjaxPhaseListener.java:76)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:211)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:329)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:216)
       at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:93)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
       at java.lang.Thread.run(Thread.java:595)


      Any help would be appreciated.

        • 1. Re: No phase id bound to current thread
          Sergey Smirnov Master

          so, you are also sure you did not have two SeamPhaseListener instances declared?

          • 2. Re: No phase id bound to current thread
            Scott Olcott Newbie

            Yes, there is only one SeamPhaseListener defined in my faces-config.xml.

            • 3. Re: No phase id bound to current thread
              Sergey Smirnov Master

              so, no SeamPhaseListener in the web.xml and no WEB-INF/faces-config.xml in the web.xml as well?

              • 4. Re: No phase id bound to current thread
                . . Newbie

                Same problem here,
                exception just seems to be eaten by the server (app continues).

                glassfish/seam1.2/richfaces

                <a4j:commandButton action="#{NewJSFManagedBean.test}" value="test"/>
                __
                phase(RESTORE_VIEW 1,com.sun.faces.context.FacesContextImpl@1c2a8b8) threw exception: java.lang.IllegalStateException: No phase id bound to current thread (make sure you do not have two SeamPhaseListener instances installed) No phase id bound to current thread (make sure you do not have two SeamPhaseListener instances installed)
                 org.jboss.seam.contexts.PageContext.getPhaseId(PageContext.java:153)
                 org.jboss.seam.contexts.PageContext.isRenderResponsePhase(PageContext.java:165)
                 org.jboss.seam.contexts.PageContext.getCurrentReadableMap(PageContext.java:76)
                 org.jboss.seam.contexts.PageContext.get(PageContext.java:66)
                 org.jboss.seam.contexts.Contexts.lookupInStatefulContexts(Contexts.java:160)
                 org.jboss.seam.Component.getInstance(Component.java:1577)
                 org.jboss.seam.Component.getInstance(Component.java:1572)
                 org.jboss.seam.jsf.SeamELResolver.getValue(SeamELResolver.java:49)
                 javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
                 com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
                 com.sun.faces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:72)
                 org.ajax4jsf.framework.ajax.AjaxContext.getCurrentInstance(AjaxContext.java:150)
                 org.ajax4jsf.framework.renderer.AjaxPhaseListener.afterPhase(AjaxPhaseListener.java:76)
                 com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
                 com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                 javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                 org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
                 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
                 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
                 org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
                 org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
                 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
                 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
                 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
                 org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
                 org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
                 org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
                 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
                 org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
                 com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
                 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
                 org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
                 com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
                 org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
                 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
                 org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
                 org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
                 org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
                 org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
                 com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
                 com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
                 com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
                 com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
                 com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
                 com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
                 com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
                 *** ManagedBean: Test
                

                no SeamPhaseListener in the web.xml and no WEB-INF/faces-config.xml in the web.xml as well


                • 5. Re: No phase id bound to current thread
                  Scott Olcott Newbie

                  No I don't define WEB-INF/faces-config.xml in web.xml and there is no SeamPhaseListener in web.xml either. If either were defined there I would have gotten the same error before upgrading. I've also made sure that the old ajax4jsf.jar file is deleted.

                  Here is my faces-config:

                  <faces-config>
                   <application>
                   <message-bundle>messages</message-bundle>
                   <default-render-kit-id>org.apache.myfaces.trinidad.core</default-render-kit-id>
                   <locale-config>
                   <default-locale>en</default-locale>
                   </locale-config>
                   </application>
                   <lifecycle>
                   <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
                   </lifecycle>
                  </faces-config>
                  


                  and here is my web.xml

                  <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
                   <!-- FaceletViewHandler configuration -->
                   <listener>
                   <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
                   </listener>
                   <context-param>
                   <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                   <param-value>client</param-value>
                   </context-param>
                   <context-param>
                   <param-name>facelets.DEVELOPMENT</param-name>
                   <param-value>true</param-value>
                   </context-param>
                   <context-param>
                   <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                   <param-value>.xhtml</param-value>
                   </context-param>
                   <context-param>
                   <param-name>org.ajax4jsf.SKIN</param-name>
                   <param-value>DEFAULT</param-value>
                   </context-param>
                   <context-param>
                   <param-name>com.sun.faces.verifyObjects</param-name>
                   <param-value>false</param-value>
                   </context-param>
                   <context-param>
                   <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
                   <param-value>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</param-value>
                   </context-param>
                   <filter>
                   <display-name>Ajax4jsf Filter</display-name>
                   <filter-name>ajax4jsf</filter-name>
                   <filter-class>org.ajax4jsf.Filter</filter-class>
                   </filter>
                   <filter-mapping>
                   <filter-name>ajax4jsf</filter-name>
                   <url-pattern>/*</url-pattern>
                   </filter-mapping>
                  
                   <servlet>
                   <servlet-name>Faces Servlet</servlet-name>
                   <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                   <load-on-startup>1</load-on-startup>
                   </servlet>
                   <servlet>
                   <servlet-name>Seam Resource Servlet</servlet-name>
                   <servlet-class>org.jboss.seam.servlet.ResourceServlet</servlet-class>
                   </servlet>
                   <servlet-mapping>
                   <servlet-name>Seam Resource Servlet</servlet-name>
                   <url-pattern>/seam/resource/*</url-pattern>
                   </servlet-mapping>
                   <servlet>
                   <servlet-name>resources</servlet-name>
                   <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
                   </servlet>
                   <servlet-mapping>
                   <servlet-name>resources</servlet-name>
                   <url-pattern>/adf/*</url-pattern>
                   </servlet-mapping>
                   <filter>
                   <filter-name>Seam Filter</filter-name>
                   <filter-class>org.jboss.seam.web.SeamFilter</filter-class>
                   </filter>
                   <filter-mapping>
                   <filter-name>Seam Filter</filter-name>
                   <url-pattern>/*</url-pattern>
                   </filter-mapping>
                   <filter>
                   <filter-name>trinidad</filter-name>
                   <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
                   </filter>
                   <filter-mapping>
                   <filter-name>trinidad</filter-name>
                   <servlet-name>Faces Servlet</servlet-name>
                   </filter-mapping>
                   <servlet-mapping>
                   <servlet-name>Faces Servlet</servlet-name>
                   <url-pattern>/faces/*</url-pattern>
                   </servlet-mapping>
                   <error-page>
                   <error-code>404</error-code>
                   <location>/error/404.jsp</location>
                   </error-page>
                   <error-page>
                   <error-code>403</error-code>
                   <location>/error/404.jsp</location>
                   </error-page>
                   <error-page>
                   <error-code>500</error-code>
                   <location>/error/500.jsp</location>
                   </error-page>
                   <login-config>
                   <auth-method>BASIC</auth-method>
                   </login-config>
                  </web-app>


                  I tried replacing the ALTERNATE_VIEW_HANDLER context-param in web.xml from org.jboss.seam.ui.facelet.SeamFaceletViewHandler to com.sun.facelets.FaceletViewHandler as recommended on the trinidad wiki, but the same error occured

                  • 6. Re: No phase id bound to current thread
                    Alexander Smirnov Master

                    At most, looks like a Seam bug.
                    In ajax4jsf 1.0.x , AjaxContext have a configuration by META-INF/services , for change concrete implementstion class in different environment ( for example, we have special implementation for ADF/Trinidad environment. In future, JSF 1.2 -targetted build shiuld have own context implementation ).
                    But this implementation have problems in the case of share ajax4jsf jars, due to thin classloading differences in any app servers.
                    For 1.1, implementation class of AjaxContext configured as request-scope bean,accessible by EL-expressions or via VariableResolver.
                    As I see from stack trace, Seam inplementaion of VariableResolver don't work at restore view phase ( this is not compatible with JSF specifications, I don't see any limits to using VariableResolver during JSF lifecycle ).
                    I will see for a workaround of this issue.

                    • 7. Re: No phase id bound to current thread
                      Igor Shabalov Apprentice

                      Ok, that definitely look like Seam-related problem.
                      I put issue to our Jira and initiate conversation with Seam development team. Will see what they will tell.
                      Anyway we depends from EL on earlier phases in many places, not this one only.

                      http://jira.jboss.org/jira/browse/AJSF-6