5 Replies Latest reply on May 2, 2007 6:32 AM by Champion Louis

    Strange Seam Actor component problem

    Marcin Makowski Newbie

      I have a stateless bean which used an Actor Seam object. The bean is based on similar ones provided in official Seam examples and is rather easy:

      package pl.ist.bpm.ui.login;
      
      import java.io.Serializable;
      
      import javax.ejb.Stateless;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.Seam;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.contexts.Context;
      import org.jboss.seam.core.Actor;
      import org.jboss.seam.core.FacesMessages;
      
      @Stateless
      @Scope(ScopeType.SESSION)
      @Name("bpmLogin")
      public class DBLoginAction
       implements Login,
       Serializable
      {
       /**
       *
       */
       private static final long serialVersionUID = 1L;
      
       private static final String USER_VAR = "currentUser";
      
       @PersistenceContext
       private EntityManager em;
      
       @In
       Context sessionContext;
      
      
       @In(create=true)
       Actor actor;
      
       @In(create=true)
       FacesMessages facesMessages;
      
      
       String username;
      
      
       String password;
      
      
      
       public String getPassword() {
       return password;
       }
       public void setPassword(String password) {
       this.password = password;
       }
       private boolean validateFields()
       {
      
      
       if(username == null || username.equals(""))
       {
      
       facesMessages.addFromResourceBundle("loginUserName", "loginUsernameErrorMessage");
      
       }
      
       if(password == null || password.equals(""))
       {
       facesMessages.addFromResourceBundle("loginPassword", "loginPasswordErrorMessage");
      
       }
       if(username == null || username.equals("") || password == null || password.equals(""))
       return false;
       return true;
      
       }
       public String login() {
       try {
      
      
       if(!validateFields())
       return null;
      
       User found =
       (User) em.createQuery("select u from User u where u.username = :userName and u.password = :password")
       .setParameter("userName", username)
       .setParameter("password", password)
       .getSingleResult();
       if(found != null)
       {
       sessionContext.set(USER_VAR, found);
       actor.setId(username);
       System.out.print(actor.getId());
       return "todo";
       }
       return null;
       } catch (Exception e) {
       // this message is lost in the session invalidation
      
      
       FacesMessages.instance().add("loginErrorPrompt");
       Seam.invalidateSession();
       return null;
       }
       }
      
       public String logout() {
       actor.setId(null);
       Seam.invalidateSession();
       sessionContext.set(USER_VAR, null);
       sessionContext.set("loggedIn", null);
       return "logout";
       }
      
       public String getUsername() {
       return username;
       }
       public void setUsername(String username) {
       this.username = username;
       }
      
      
      }
      


      next comes the login page that used that bean:
      <!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:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:visuals="urn:taglib:/WEB-INF/tags"
       xmlns:h="http://java.sun.com/jsf/html">
       <body>
       <ui:composition template="/WEB-INF/templates/nosiderbar.xhtml">
       <ui:param name="titleImage" value="Images/login/title_login.png" />
       <ui:param name="backgroundImage"
       value="Images/login/background_login.png" />
       <ui:define name="header">
       <ui:include src="/WEB-INF/includes/header.xhtml">
       </ui:include>
       </ui:define>
       <ui:define name="body">
       <f:view>
       <h:form>
       <div id="loginPanelPadding">
       <table border="0" align="center">
       <s:validateAll>
       <tr>
       <td colspan="2">
      
       </td>
       </tr>
       <tr>
       <td>
      
       <h:outputText value="#{messages.loginUsername}" />
       </td>
       <td>
      
       <h:inputText value="#{bpmLogin.username}" id = "loginUserName"/>
       </td>
       <td><span class = "cntError"><h:message for="loginUserName"/></span></td>
       </tr>
       <tr>
       <td >
       <h:outputText value="#{messages.loginPassword}" />
       </td>
       <td>
       <h:inputSecret value="#{bpmLogin.password}" id = "loginPassword"/>
      
       </td>
       <td><span class = "cntError"><h:message for="loginPassword"/></span></td>
      
       </tr>
       <tr>
       <td colspan="2">
       <h:commandButton action="#{bpmLogin.login}" value="#{messages.loginLogin}"/>
       </td>
       </tr>
       </s:validateAll>
       </table>
       </div>
       </h:form>
       </f:view>
       </ui:define>
       </ui:composition>
       </body>
      </html>
      


      while trying to access this page I get following error stack
      javax.faces.el.EvaluationException: /login.xhtml @36,75 value="#{bpmLogin.username}": Exception getting value of property username of base of type : org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$fecf9761
       at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:60)
       at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
       at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:217)
       at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:135)
       at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:53)
       at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:580)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
       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.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.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)
      Caused by: javax.faces.el.EvaluationException: Bean: org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$fecf9761, property: username
       at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:442)
       at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:82)
       at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:141)
       at com.sun.el.parser.AstValue.getValue(AstValue.java:117)
       at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
       at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
       at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
       ... 38 more
      Caused by: java.lang.reflect.InvocationTargetException
       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.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)
       ... 44 more
      Caused by: javax.ejb.EJBTransactionRolledbackException: org.jboss.seam.RequiredException: In attribute requires value for component: bpmLogin.actor
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:93)
       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
       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:62)
       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.stateless.StatelessContainer.localInvoke(StatelessContainer.java:211)
       at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
       at $Proxy89.getUsername(Unknown Source)
       at pl.ist.bpm.ui.login.Login$$FastClassByCGLIB$$71f5b82f.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.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:38)
       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: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.SynchronizationInterceptor.serialize(SynchronizationInterceptor.java:30)
       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.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$$fecf9761.getUsername(<generated>)
       ... 49 more
      Caused by: org.jboss.seam.RequiredException: In attribute requires value for component: bpmLogin.actor
       at org.jboss.seam.Component.getInstanceToInject(Component.java:1876)
       at org.jboss.seam.Component.injectFields(Component.java:1342)
       at org.jboss.seam.Component.inject(Component.java:1112)
       at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:48)
       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.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:23)
       at sun.reflect.GeneratedMethodAccessor110.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.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:51)
       at sun.reflect.GeneratedMethodAccessor109.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.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:49)
       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.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
       ... 91 more
      


      while playing a bit with @In annotation for actor I dicovered that adding (required=false) helps with ridding off the problem, but only for a while. Submiting the form (=calling bpmLogin.login()) prooves that something is wrong again: the actor field is always null so I get NullPointerException.

      Exception during INVOKE_APPLICATION(5): java.lang.NullPointerException
      org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:93)
      org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
      org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:211)
      org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
      $Proxy335.login(Unknown Source)
      pl.ist.ui.login.Login$$FastClassByCGLIB$$e486f340.invoke(<generated>)
      net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
      org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
      org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:73)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
      org.jboss.seam.interceptors.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:38)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      org.jboss.seam.interceptors.SynchronizationInterceptor.serialize(SynchronizationInterceptor.java:30)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
      org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
      org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
      org.jboss.seam.intercept.ClientSideInterceptor.interceptInvocation(ClientSideInterceptor.java:82)
      org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:51)
      org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$e1466007.login(<generated>)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      com.sun.el.parser.AstValue.invoke(AstValue.java:151)
      com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
      com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
      com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
      org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
      javax.faces.component.UICommand.broadcast(UICommand.java:106)
      javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
      javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
      org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
      org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      java.lang.Thread.run(Thread.java:595)
      


      I cannot get it, especially that examples provided in the Seam 1.1.0 package are (erh, almost) the same and work perfectly. Can someone help me?

        • 1. Re: Strange Seam Actor component problem
          Gavin King Master

          Well, a stateless session bean cant have properties, to begin with....

          • 2. Re: Strange Seam Actor component problem
            Marcin Makowski Newbie

            Thanks for the reply. I used LoginAction from the dvd store example which also uses stateless bean, provides the same functionality and does work. Could you please explain what's the difference?

            package com.jboss.dvd.seam;
            
            import java.io.Serializable;
            
            import javax.ejb.Stateless;
            import javax.persistence.EntityManager;
            import javax.persistence.PersistenceContext;
            
            import org.jboss.seam.Seam;
            import org.jboss.seam.annotations.In;
            import org.jboss.seam.annotations.Name;
            import org.jboss.seam.contexts.Context;
            import org.jboss.seam.core.Actor;
            import org.jboss.seam.core.FacesMessages;
            
            @Stateless
            @Name("login")
            public class LoginAction
             implements Login,
             Serializable
            {
             private static final String USER_VAR = "currentUser";
            
             @PersistenceContext
             private EntityManager em;
            
             @In Context sessionContext;
            
             @In Actor actor;
            
             String username = "";
             String password = "";
            
             public String getUserName() {
             return username;
             }
             public void setUserName(String username) {
             this.username = username;
             }
            
             public String getPassword() {
             return password;
             }
             public void setPassword(String password) {
             this.password = password;
             }
            
             public String login() {
             try {
             User found =
             (User) em.createQuery("select u from User u where u.userName = :userName and u.password = :password")
             .setParameter("userName", username)
             .setParameter("password", password)
             .getSingleResult();
            
             sessionContext.set(USER_VAR, found);
            
             actor.setId(username);
            
             if (found instanceof Admin) {
             actor.getGroupActorIds().add("shippers");
             actor.getGroupActorIds().add("reviewers");
             System.out.println("ADMIN");
             return "admin";
             } else {
             return null; // redisplay the current page
             }
             } catch (Exception e) {
             // this message is lost in the session invalidation
             FacesMessages.instance().addFromResourceBundle("loginErrorPrompt");
             Seam.invalidateSession();
             return "home";
             }
             }
            
             public String logout() {
             Seam.invalidateSession();
             sessionContext.set(USER_VAR, null);
             sessionContext.set("loggedIn", null);
             return "logout";
             }
            
             private User currentUser() {
             return (User) sessionContext.get(USER_VAR);
             }
            
             public boolean isLoggedIn() {
             return currentUser() != null;
             }
            
             public boolean isCustomer() {
             User user = currentUser();
             return (user!=null) && (user instanceof Customer);
             }
            
             public boolean isAdmin() {
             User user = currentUser();
             return (user!=null) && (user instanceof Admin);
             }
            
             public String adminCheck() {
             if(isAdmin())
             {
             return null;
             }
             return "home";
            
            
             }
            }
            


            • 3. Re: Strange Seam Actor component problem
              Marcin Makowski Newbie

              It looks like .jar placing in projects problem.

              Removing the lines connected with Actor Seam component makes the problem disapear.

              I have three Eclipse projects.

              EAR:
              + jboss-seam.jar
              + el-api.jar
              + el-ri.jar
              + jbpm-3.1.2.jar

              JAR
              + hibernate-all.jar
              + myfaces-api-1.1.4.jar
              + jboss-ejb3-all.jar
              + jboss-seam.jar [referenced from EAR]
              + el-api.jar [referenced from EAR]
              + el-ri.jar [referenced from EAR]
              + jbpm-3.1.2.jar [referenced from EAR]

              WAR
              + jboss-seam-ui.jar
              + jboss-seam-debug.jar
              + jsf-facelets.jar
              + standard.jar

              any ideas?

              • 4. Re: Strange Seam Actor component problem
                Champion Louis Newbie

                Hi,
                I also have a problem with the Seam Actor Java Bean.

                I'm currently using a seam project generated with seam-gen and I'm trying to use JBPM with it. I have take the dvdstore authenticator to test authentification :

                Stateless
                @Name("authenticator")
                public class AuthenticatorAction implements Authenticator
                {
                 private static final String USER_VAR = "currentUser";
                
                 @PersistenceContext
                 private EntityManager entityManager;
                
                 @In
                 Context sessionContext;
                
                 @In(create=true)
                 Actor actor;
                
                 @In
                 Identity identity;
                
                 public boolean authenticate()
                 {
                
                 User found;
                 try {
                 found = (User)
                 entityManager.createQuery("select u from User u where u.userName = #{identity.username} and u.password = #{identity.password}")
                 .getSingleResult();
                 } catch (PersistenceException e) {
                 return false;
                 }
                
                 sessionContext.set(USER_VAR, found);
                
                 actor = new Actor();
                
                 actor.setId(identity.getUsername());
                
                 if (found instanceof Prescriptor)
                 {
                 actor.getGroupActorIds().add("prescriptor");
                
                 }
                 else if(found instanceof Agent){
                
                 actor.getGroupActorIds().add("agent");
                 }
                 else if(found instanceof Organization){
                
                 actor.getGroupActorIds().add("organization");
                 }
                 else if(found instanceof Admin){
                 identity.addRole("admin");
                 }
                
                 return true;
                 }
                }
                


                In my components.xml :
                 <security:identity authenticate-method="#{authenticator.authenticate}"/>
                


                In the login.xhtml :
                 <h:form id="login">
                
                 <rich:panel>
                 <f:facet name="header">Login</f:facet>
                
                 <p>Please login using any username and password</p>
                
                 <div class="dialog">
                 <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
                 <h:outputLabel for="username">Username</h:outputLabel>
                 <h:inputText id="username"
                 value="#{identity.username}"/>
                 <h:outputLabel for="password">Password</h:outputLabel>
                 <h:inputSecret id="password"
                 value="#{identity.password}"/>
                 <h:outputLabel for="rememberMe">Remember me</h:outputLabel>
                 <h:selectBooleanCheckbox id="rememberMe"
                 value="#{identity.rememberMe}"/>
                 </h:panelGrid>
                 </div>
                
                 </rich:panel>
                
                 <div class="actionButtons">
                 <h:commandButton value="Login" action="#{identity.login}"/>
                 </div>
                
                 </h:form>
                


                The only difference between dvdstore project and mine is on the initialization of the components, I have this with the dvdstore case (not present in my project) :

                11:04:06,545 INFO [Component] Component: org.jboss.seam.core.actor, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.Actor
                


                In the debug page(dvdstore) we can see the org.jboss.seam.security.identity components in the Session Context and the org.jboss.seam.core.actor.component in the Application context.

                In the debug page(my project) we can see the org.jboss.seam.security.identity components in the Session Context but not the org.jboss.seam.core.actor.component in the Application context.

                I think that my problem come from this difference but I don't really konw how to resolve it. Any Suggestion ?

                Thanks

                • 5. Re: Strange Seam Actor component problem
                  Champion Louis Newbie

                  I have found why the Seam Actor Component wasn't auto-created. I haven't associated an workflow file .jpdl.xml in the components.xml