2 Replies Latest reply on Feb 26, 2008 11:23 PM by Vemula sriramsudheer

    seam and statfulSessionBean (EJB 3.0)

    Vemula sriramsudheer Newbie

      Hi, I am using seam and i made statefulsessionBean a seam component and i am trying to inject that component in other components, Please help me if i am missing some thing important

      The following is the stateful session bean + seam component:

      import javax.ejb.Local;
      import javax.ejb.Remove;
      import javax.ejb.Stateful;
      
      import org.jboss.seam.annotations.AutoCreate;
      import org.jboss.seam.annotations.Create;
      import org.jboss.seam.annotations.Destroy;
      import org.jboss.seam.annotations.Name;
      
      @Stateful
      @Name("testSessionEjb")
      @AutoCreate
      @Local(ITestSessionEjb.class)
      public class TestSessionEjb implements ITestSessionEjb{
      
       @Create
       public void test() {
       System.out.println("sriama");
       }
      
       @Destroy
       @Remove
       public void destroy() {
      
       }
      
      }
      


      The following is the Local Inteface
      mport javax.ejb.Local;
      
      @Local
      public interface ITestSessionEjb {
      
       public void test();
       public void destroy();
      }


      The following is another component where i am injecting:
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.log.Log;
      import org.jboss.seam.security.Identity;
      
      
      @Name("authenticator")
      public class Authenticator
      {
       @Logger Log log;
      
       @In Identity identity;
      
       @In TestSessionEjb testSessionEjb;
      
       public boolean authenticate()
       {
       log.info("authenticating #0", identity.getUsername());
       //write your authentication logic here,
       //return true if the authentication was
       //successful, false otherwise
       testSessionEjb.test();
       identity.addRole("admin");
       return true;
       }
      }


      The following is the exception i am getting:
      5:06:02,844 ERROR [SeamLoginModule] Error invoking login method
      javax.el.ELException: java.lang.IllegalArgumentException: could not set field value: authenticator.testSessionEjb
       at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:333)
       at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
       at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
       at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
       at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
       at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:173)
       at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:109)
       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 javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
       at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
       at javax.security.auth.login.LoginContext$5.run(LoginContext.java:706)
       at java.security.AccessController.doPrivileged(Native Method)
       at javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703)
       at javax.security.auth.login.LoginContext.login(LoginContext.java:575)
       at org.jboss.seam.security.Identity.authenticate(Identity.java:259)
       at org.jboss.seam.security.Identity.authenticate(Identity.java:248)
       at org.jboss.seam.security.Identity.quietLogin(Identity.java:237)
       at org.jboss.seam.security.Identity.isLoggedIn(Identity.java:145)
       at org.jboss.seam.security.Identity.isLoggedIn(Identity.java:135)
       at sun.reflect.GeneratedMethodAccessor367.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
       at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
       at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
       at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
       at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:111)
       at org.jboss.seam.navigation.Rule.matches(Rule.java:30)
       at org.jboss.seam.navigation.Navigation.navigate(Navigation.java:56)
       at org.jboss.seam.navigation.Pages.navigate(Pages.java:134)
       at org.jboss.seam.jsf.SeamNavigationHandler.handleNavigation(SeamNavigationHandler.java:42)
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:119)
       at javax.faces.component.UICommand.broadcast(UICommand.java:383)
       at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
       at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
       at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)