[jboss-user] [JBoss Seam] - Re: no page context active exception when use seam pdf

jiyuan_wang do-not-reply at jboss.com
Thu Nov 1 17:52:15 EDT 2007


After debugging, find out the problem located in org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(PhaseEvent event).

there is a fix for a bug in MyFaces prior to 1.1.3 (I don't know what exactly is the bug though). 

------------------------------------------------------------
//workaround for a bug in MyFaces prior to 1.1.3         
if ( Init.instance().isMyFacesLifecycleBug() ) 
{
    Lifecycle.endRequest( facesContext.getExternalContext() );
}
------------------------------------------------------------

And in Lifecycle.endRequest(), it will clear all the Threadlocals.
------------------------------------------------------------
      Contexts.eventContext.set(null);
      Contexts.pageContext.set(null);
      Contexts.sessionContext.set(null);
      Contexts.conversationContext.set(null);
      Contexts.businessProcessContext.set(null);
      Contexts.applicationContext.set(null);
------------------------------------------------------------

After clearing all the contexts, AbstractSeamPhaseListener tries to get an instance of the FacesPage and store the conversation and page flow. 
------------------------------------------------------------
      FacesPage.instance().storeConversation();
      FacesPage.instance().storePageflow();
------------------------------------------------------------

And here comes the exceptions, which are swallowed by SEAM though (but shows in the server/app log).  In the method of getting an instance of FacesPage, it will check if the page context is active or not. if not, then throws an exception. 
------------------------------------------------------------
public static FacesPage instance()
   {
      if ( !Contexts.isPageContextActive() )
      {
         throw new IllegalStateException("No page context active");
      }
      return (FacesPage) Component.getInstance(FacesPage.class, ScopeType.PAGE);
   }
------------------------------------------------------------

I guess I will try to upgrade MyFaces lib to a newer version to see if I can remove this annoying error message in the log. 

or anybody knows how to solve this problem and let me know, I'll really appreciate it. 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4101097#4101097

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4101097



More information about the jboss-user mailing list