[jboss-user] [JBoss Seam] - problem with Starting conversations with GET requests

jason_rency do-not-reply at jboss.com
Mon Jul 31 07:10:05 EDT 2006


Hi all, 

I tried to invoke a method in a session bean when rendering a page. 
the problem is when the page is rendered by using a newly created browser, the method can't be invoked and the following exception is thrown. 

10:05:46,706 ERROR [PhaseListenerManager] Exception in PhaseListener RENDER_RESPONSE(6) beforePhase.
  | 
  | javax.faces.el.EvaluationException: Exception while invoking expression #{login.test}
  | 	at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
  | 	at org.jboss.seam.core.Pages.callAction(Pages.java:161)
  | 	at org.jboss.seam.core.Pages.callAction(Pages.java:143)
  | 	at org.jboss.seam.jsf.AbstractSeamPhaseListener.callPageActions(AbstractSeamPhaseListener.java:128)
  | 
  | 	at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:98)
  | 	at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:50)
  | 	at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManage
  | r.java:70)
  | 	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
  | 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252
  | )
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
  | 	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.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(Http11Base
  | Protocol.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)
  | Caused by: javax.ejb.EJBException: org.jboss.seam.RequiredException: In attribute requires value for
  |  component: login.reguser
  | 	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:197)
  | 	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.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:6
  | 2)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
  | 	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.stateless.StatelessContainer.localInvoke(StatelessContainer.java:181)
  | 	at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
  | 	at $Proxy128.chagen(Unknown Source)
  | 	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.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
  | 	... 29 more
  | Caused by: org.jboss.seam.RequiredException: In attribute requires value for component: login.reguse
  | r
  | 	at org.jboss.seam.Component.getInstanceToInject(Component.java:1382)
  | 	at org.jboss.seam.Component.injectFields(Component.java:1024)
  | 	at org.jboss.seam.Component.inject(Component.java:795)
  | 	at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java
  | :30)
  | 	at sun.reflect.GeneratedMethodAccessor108.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:13)
  | 	at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  | 	at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  | 	at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(Conversati
  | onInterceptor.java:82)
  | 	at sun.reflect.GeneratedMethodAccessor107.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:13)
  | 	at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  | 	at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  | 	at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProc
  | essInterceptor.java:60)
  | 	at sun.reflect.GeneratedMethodAccessor106.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:13)
  | 	at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  | 	at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  | 	at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
  | 	at sun.reflect.GeneratedMethodAccessor105.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:13)
  | 	at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
  | 	at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
  | 	at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
  | 	at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
  | 	at sun.reflect.GeneratedMethodAccessor104.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
  | 	at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:6
  | 3)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityMa
  | nagerInterceptor.java:54)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  | 	... 49 more	 


the method can be invoked when the page is rendering by a page action within the same page with no exceptions. 

the method can be invoked when the page is rendering by a S Link within another page with the following exceptions: 

the S Link: 

  | <s:link value="Cancel" action="login" linkStyle="button" buttonClass="button"/> 

the exceptions: 

  | 10:39:22,505 ERROR [PhaseListenerManager] Exception in PhaseListener RENDER_RESPONSE(6) afterPhase
  | java.lang.IllegalStateException: No active application scope
  | 	at org.jboss.seam.core.Init.instance(Init.java:48)
  | 	at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:87)
  | 	at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager
  | .java:89)
  | 	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:391)
  | 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252
  | )
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
  | 	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.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(Http11Base
  | Protocol.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)	 


I defined a page action in the pages.xml like this: 


  | <pages>
  | 	<page view-id="/home.xhtml" action="#{login.test}"/>
  | </pages> 	 

the session bean where the method and the same page page acction is defined: 


package src.reg.server;
  | 
  | import javax.ejb.Stateless;
  | import javax.persistence.EntityManager;
  | import javax.persistence.PersistenceContext;
  | 
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Out;
  | import org.jboss.seam.contexts.Contexts;
  | import org.jboss.seam.core.FacesMessages;
  | 
  | @Stateless
  | @Name("login")
  | public class LoginAction implements Login
  | {
  |    
  |    @In @Out
  |    private Reguser reguser;
  |        
  |    @PersistenceContext
  |    private EntityManager em;
  |          
  |    private String rnd;
  |    
  |    
  |    public String test()
  |    {
  |       int i=0
  |       rnd = i;
  |       i++;
  | 
  |       System.out.println("the next rnd is:"+rnd);
  |       FacesMessages.instance().add(rnd);
  |       return rnd;
  |    }
  |    
  | public String login()
  |     {  	   
  |         Reguser user;
  |         user = em.find(Reguser.class, reguser.getUid());
  |         System.out.println("the current rnd is:"+rnd);
  |       if ( user==null )
  |       {
  |          FacesMessages.instance().add("USER ID wrong");
  |          return "login";
  |       }
  |       else
  |       {
  |          return "main"
  |        }
  |     }
  | 
  | }	 


the login page: login.xhtml 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | <html xmlns="http://www.w3.org/1999/xhtml"
  | 	  xmlns:ui="http://java.sun.com/jsf/facelets"
  | 	  xmlns:h="http://java.sun.com/jsf/html">
  | <head>
  | 	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  | 	<title>login page</title>
  | 	<link href="css/screen.css" rel="stylesheet" type="text/css" />
  | </head>
  | <body id="pgHome">
  | <h:form>
  | <div id="document">
  | 	<div id="header">
  | 	</div>
  | 	<div id="container">
  | 		<div id="sidebar">
  | 			<fieldset>
  | 				<div>
  | 					<h:outputLabel for="uid">User ID</h:outputLabel>
  | 					<h:inputText id="uid" value="#{reguser.uid}" style="width: 175px;"/>
  | 					<div class="errors"><h:message for="uid"/></div>
  | 				</div>
  | 				<div class="errors"><h:messages globalOnly="true"/></div>
  | 				<div class="buttonBox"><h:commandButton action="#{login.login}" value="Account Login" class="button" /></div>
  | 			</fieldset>
  | 		</div>
  | 		<div id="content">
  | 			<div class="section">
  | 			    <h1>seam</h1>  							
  | 			</div>
  | 		</div>
  | 	</div>
  | 	<div id="footer">login</div>
  | </div>
  | </h:form>
  | </body>
  | </html>
	 


any suggestions? 

thanks a lot 
Jason 
 


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

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



More information about the jboss-user mailing list