[jboss-user] [JBoss Seam] - pageflow NPE: redirect to page with request parameters

mgombocz do-not-reply at jboss.com
Mon Feb 26 13:21:54 EST 2007


Hi,
I've defined a simple 2-step pageflow for creating new users in my app:
* The 1st page "editUser.xhtml" is just for entering basic information.
* On my 2nd page (editUserRoles.xhtml) several roles can be assigned.
* There's a <s:link> with action="save" which selects a transition that calls #{userManager.flush}.
* This transition leads to view "showUser.xhtml" which requires the page parameter "userId".

But before "showUser.xhtml" is being rendered a NPE occurs. Please see following trace starting right after Hibernate's DB operations:
2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] outjecting dependencies of: userManager
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] initializing new instance of: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] done initializing: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] initializing new instance of: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] done initializing: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.core.Events] Processing event:org.jboss.seam.preSetVariable.user
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] initializing new instance of: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] done initializing: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] initializing new instance of: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] done initializing: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.core.Events] Processing event:org.jboss.seam.postSetVariable.user
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] disinjecting dependencies of: userManager
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.contexts.Contexts] found in conversation context: org.jboss.seam.core.persistenceContexts
  | 2007-02-26 18:49:22,015 DEBUG [org.jbpm.graph.def.GraphElement] event 'node-enter' on 'Page(finished)' for 'Token(/)'
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.core.Manager] Ending long-running conversation
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] initializing new instance of: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] done initializing: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] initializing new instance of: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.Component] done initializing: org.jboss.seam.core.events
  | 2007-02-26 18:49:22,015 DEBUG [org.jboss.seam.core.Events] Processing event:org.jboss.seam.endConversation
  | 2007-02-26 18:49:22,015 DEBUG [org.jbpm.graph.def.GraphElement] event 'after-signal' on 'Page(enterRoles)' for 'Token(/)'
  | 2007-02-26 18:49:22,015 DEBUG [org.jbpm.JbpmContext] closing JbpmContext
  | 2007-02-26 18:49:22,015 ERROR [org.jboss.seam.jsf.SeamPhaseListener] uncaught exception
  | java.lang.NullPointerException
  | 	at org.jboss.seam.core.Pages.getConvertedParameters(Pages.java:556)
  | 	at org.jboss.seam.core.Pages.encodePageParameters(Pages.java:692)
  | 	at org.jboss.seam.core.Manager.redirect(Manager.java:972)
  | 	at org.jboss.seam.core.Manager.redirect(Manager.java:948)
  | 	at org.jboss.seam.core.Pageflow.redirect(Pageflow.java:221)
  | 	at org.jboss.seam.core.Pageflow.navigate(Pageflow.java:209)
  | 	at org.jboss.seam.core.Pageflow.navigate(Pageflow.java:299)
  | 	at org.jboss.seam.jsf.SeamNavigationHandler.handleNavigation(SeamNavigationHandler.java:30)
  | 	at org.jboss.seam.core.Pages.handleOutcome(Pages.java:425)
  | 	at org.jboss.seam.core.Pages.callAction(Pages.java:473)
  | 	at org.jboss.seam.core.Pages.enterPage(Pages.java:275)
  | 	at org.jboss.seam.jsf.AbstractSeamPhaseListener.enterPage(AbstractSeamPhaseListener.java:242)
  | 	at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:193)
  | 	at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:57)
  | 	at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
  | 	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
  | 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
  | 	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:75)
  | 	at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 	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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
  | 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
  | 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
  | 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
  | 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
  | 	at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
  | 	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.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
  | 	at java.lang.Thread.run(Thread.java:595)
  | 
Here's my jPDL:
<pageflow-definition name="createUser">
  | 
  | 	<start-page name="createUser" view-id="/editUser.xhtml">
  | 		<description>Create new user</description>
  | 
  | 		<transition name="cancel" to="cancelled" />
  | 
  | 		<transition name="save" to="enterRoles">
  | 			<action expression="#{userManager.save}" />
  | 		</transition>
  | 	</start-page>
  |       
  | 	<page name="enterRoles" view-id="/editUserRoles.xhtml">
  | 		<description>Assign roles</description>
  | 		<redirect />
  | 
  | 		<transition name="save" to="finished"> 
  | 	 		<action expression="#{userManager.flush}" />
  | 		</transition>
  | 
  | 		<transition name="cancel" to="cancelled" />
  | 	</page>
  |    
  | 	<page name="finished" view-id="/showUser.xhtml">
  | 		<redirect />
  | 		<end-conversation />
  | 	</page>
  |    
  | 	<page name="cancelled" view-id="/searchUser.xhtml">
  | 		<redirect />
  | 		<end-conversation />
  | 	</page>
  |    
  | </pageflow-definition>
  | 
Here's an excerpt from pages.xml:
<pages no-conversation-view-id="/error.xhtml"
  |                  login-view-id="/login.xhtml">
  | ...
  | 	<page view-id="/searchUser.xhtml" login-required="true">
  | 		<param name="firstResult" value="#{users.firstResult}"/>
  | 		<param name="username" value="#{exampleUser.username}"/>
  | 
  | 		<navigation from-action="#{userManager.create}" >
  | 			<begin-conversation pageflow="createUser" flush-mode="manual" />
  | 			<redirect view-id="/editUser.xhtml" />
  | 		</navigation>
  | 	</page>	
  | 
  | 	<page view-id="/showUser.xhtml" login-required="true">
  | 		<param name="userId" value="#{user.id}" />
  | 		<navigation>
  | 			<rule if-outcome="editUser">
  | 				<begin-conversation />
  | 				<redirect view-id="/editUser.xhtml" />
  | 			</rule>
  | 			<rule if-outcome="editUserRoles">
  | 				<begin-conversation flush-mode="manual" />
  | 				<redirect view-id="/editUserRoles.xhtml" />
  | 			</rule>
  | 		</navigation>
  | 	</page>
  | 
  | 	<page view-id="/editUser.xhtml" login-required="true" conversation-required="true">
  | 		<navigation from-action="#{userManager.save}">
  | 			<end-conversation />
  | 			<redirect view-id="/showUser.xhtml" />
  | 		</navigation>
  | 		<navigation>
  | 			<rule if-outcome="save">
  | 				<end-conversation />
  | 				<redirect view-id="/showUser.xhtml" />
  | 			</rule>
  | 			<rule if-outcome="cancel" if="#{not userManager.newlyCreated}">
  | 				<end-conversation/>
  | 				<redirect view-id="/showUser.xhtml" />
  | 			</rule>
  | 		</navigation>
  | 	</page>
  | 
  | 	<page view-id="/editUserRoles.xhtml" login-required="true" conversation-required="true">
  | 		<navigation from-action="#{userManager.flush}">
  | 			<end-conversation />
  | 			<redirect view-id="/showUser.xhtml" />
  | 		</navigation>
  | 		<navigation>
  | 			<rule if-outcome="cancel" if="#{not userManager.newlyCreated}">
  | 				<end-conversation before-redirect="true"/>
  | 				<redirect view-id="/showUser.xhtml" />
  | 			</rule>
  | 		</navigation>
  | 	</page>
  | ...
  | </pages>
  | 

Non-pageflow, but conversational, operations e.g. submitting "editUserRoles.xhtml" for exisiting users redirects to "showUser.xhtml" without any errors.

Is there anything that I am probably doing wrong?

Thanks!
Manuel




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

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



More information about the jboss-user mailing list