Some basic JPDL questions
hamtho2 Jan 22, 2007 8:22 AMHi,
I´ve got some basic JPDL-questions while trying to create a wizard for registering new user.
I had a jpdl-flow, which started with the following JSF-Tag:
<s:link id="registerNewUser" view="/registerUser/registerNewUser.xhtml" propagation="begin" pageflow="registerUser">#{messages.userCreateUser}</s:link>
Now I changed this call to the following code-snippet, because I have to call a method to do something before the pageflow starts:
<s:link id="registerNewUser2" action="#{ registerUserAction.startRegisterUser() }">#{messages.userCreateUser}</s:link>
This goes together with the following jpdl-file:
<?xml version="1.0" ?> <pageflow-definition name="registerUser"> <start-state name="start"> <transition name="next" to="userData"/> </start-state> <page name="userData" view-id="/registerUser/registerNewUser.xhtml"> <redirect/> <transition name="next" to="evaluateUserEmail" /> <transition name="cancel" to="cancelRegistration" /> </page> .... <decision name="addNewUser" expression="#{registerUserAction.addNewUser}"> <transition name="true" to="finish" /> <transition name="false" to="finalSummary"/> </decision> <page name="finish" view-id="/registerUser/finish.xhtml" no-conversation-view-id="/registerUser/registerNewUser.xhtml"> <redirect/> <end-conversation/> </page> </pageflow-definition>
The method startRegisterUser(), that´s called before jdpl starts looks like this:
@Begin(pageflow="registerUser") public String startRegisterUser() { System.out.println("Starting process startRegisterUser"); .... return "next"; }
Now I experience the following problems:
1. It seems, as if the pageflow doesn´t end properly. Although I have the <end-conversation/>-Tag in my jpdl-definition, I still get the values from the last conversation in my form, when clicking the link again after the old one has ended? Same thing if I use the @End annotation and call it within one method. Do I have to reset all objects used in my conversation manually or is there a way to invalidate them, so they don´t show up again?
2. When I click on my link and start my jpdl with the action, I get the following exception, but the pageflow works anyway. But I guess there´s a reason for it and I should solve this somehow.
14:01:26,135 ERROR [PhaseListenerManager] Exception in PhaseListener RENDER_RESPONSE(6) beforePhase. java.lang.IllegalStateException: No page context active at org.jboss.seam.core.FacesPage.instance(FacesPage.java:87) at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:219) at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:51) 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.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.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46) 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.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)
3. When I click on the link starting the conversation twice, without finishing the old one I get the following exception. This worked fine when starting the jpdl directly with the link and not via a method-call, as shown above. How to avoid this? Is it possible to tell, that Seam should always start a new conversation?
14:17:01,620 ERROR [Exceptions] redirecting to debug page javax.ejb.EJBException: java.lang.IllegalStateException: begin method invoked from a long running conversation, try using @Begin(join=true) at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83) at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203) at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98) at $Proxy394.startRegisterPublisher(Unknown Source) at com.sepus.seam.action.RegisterUserAction$$FastClassByCGLIB$$a93b3ccb.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45) at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:73) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55) at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.seam.util.Reflections.invoke(Reflections.java:18) at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64) at org.jboss.seam.interceptors.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:38) at sun.reflect.GeneratedMethodAccessor671.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.seam.util.Reflections.invoke(Reflections.java:18) at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64) at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144) at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102) at org.jboss.seam.intercept.ClientSideInterceptor.interceptInvocation(ClientSideInterceptor.java:82) at org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:51) at org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$151004bd.startRegisterPublisher(<generated>)
Can anyone please give more details to all this behaviour?
Thanks a lot
Thomas