12 Replies Latest reply on May 21, 2010 8:16 AM by Olalekan Ogunleye

    Error Invoking Login Method - Help Please

    Olalekan Ogunleye Newbie

      Hi All,


      I have strictly followed the booking example and I want to use this to create a login. I created a database table Userdb where I have the list of my users with username and password. When I run the application and entered the username and password inside the database the login form displayed to me the following


      Login failed
      Transaction failed


      and in my stacktrace of Jboss AS I got the following



      WARN  SeamLoginModule Error invoking login method
      javax.el.ELException: javax.ejb.EJBTransactionRolledbackException
              at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:339)
              at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
              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:175)
              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:597)
              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:344)
              at org.jboss.seam.security.Identity.authenticate(Identity.java:332)
              at org.jboss.seam.security.Identity.login(Identity.java:259)
              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:597)
              at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
              at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
              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 com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
              at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
              at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
              at javax.faces.component.UICommand.broadcast(UICommand.java:387)
              at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
              at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
              at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
              at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
              at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
              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.web.IdentityFilter.doFilter(IdentityFilter.java:40)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
              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:206)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
              at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
              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:182)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              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:262)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.ejb.EJBTransactionRolledbackException
              at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
              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:95)
              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:110)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
              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:240)
              at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
              at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
              at $Proxy146.authenticate(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:597)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
              at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
              at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
              at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
              at org.javassist.tmp.java.lang.Object$$javassistseam2.authenticate(Object$$javassistseam2.java)
              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:597)
              at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
              ... 81 more
      Caused by: java.lang.NullPointerException
              at za.co.csir.mobi4dadmin.session.Authenticator.authenticate(Authenticator.java:44)
              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:597)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
              at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
              at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:29)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:30)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
              at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
              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:597)
              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:47)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
              ... 114 more


      Can someone tell me what I am doing wrong and how to fix this error. Thank you in anticipation of your help

        • 1. Re: Error Invoking Login Method - Help Please
          Adrian Mitev Master
          java.lang.NullPointerException at za.co.csir.mobi4dadmin.session.Authenticator.authenticate(Authenticator.java:44) at 
          



          Dude, you got a NullPointerException.

          • 2. Re: Error Invoking Login Method - Help Please
            Olalekan Ogunleye Newbie

            Thank you for your response yes I got a NullPointerException. Later I figured that I had to put seam.properties in my file which I did. However, I onloy put an empty seam.properties there as I am not sure what is to be there. and after running the program again I got another exception which is below.


            10:09:34,683 WARN  SeamLoginModule Error invoking login method
            javax.el.ELException: javax.ejb.EJBTransactionRolledbackException: za.co.csir.mobi4dadmin.entity.Userdb cannot be cast to za.co.csir.mobi4dadmin.session.User
                    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:339)
                    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
                    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:175)
                    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:597)
                    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:344)
                    at org.jboss.seam.security.Identity.authenticate(Identity.java:332)
                    at org.jboss.seam.security.Identity.login(Identity.java:259)
                    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:597)
                    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
                    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
                    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 com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
                    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                    at javax.faces.component.UICommand.broadcast(UICommand.java:387)
                    at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
                    at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
                    at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
                    at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
                    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
                    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                    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.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                    at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                    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:206)
                    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
                    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
                    at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                    at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
                    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                    at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
                    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:182)
                    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                    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:262)
                    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                    at java.lang.Thread.run(Thread.java:619)
            Caused by: javax.ejb.EJBTransactionRolledbackException: za.co.csir.mobi4dadmin.entity.Userdb cannot be cast to za.co.csir.mobi4dadmin.session.User
                    at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
                    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:95)
                    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:110)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                    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:240)
                    at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
                    at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
                    at $Proxy147.authenticate(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:597)
                    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
                    at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                    at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
                    at org.javassist.tmp.java.lang.Object$$javassistseam2.authenticate(Object$$javassistseam2.java)
                    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:597)
                    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
                    ... 81 more
            Caused by: java.lang.ClassCastException: za.co.csir.mobi4dadmin.entity.Userdb cannot be cast to za.co.csir.mobi4dadmin.session.User
                    at za.co.csir.mobi4dadmin.session.Authenticator.authenticate(Authenticator.java:59)
                    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:597)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
                    at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
                    at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:29)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:30)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                    at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
                    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:597)
                    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:47)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                    ... 114 more
            I would appreciate it if you could help

            • 3. Re: Error Invoking Login Method - Help Please
              Simon Kent Newbie

              I think you've missed this exception on your stacktrace...
              Caused by: java.lang.ClassCastException: za.co.csir.mobi4dadmin.entity.Userdb cannot be cast to za.co.csir.mobi4dadmin.session.User

              • 4. Re: Error Invoking Login Method - Help Please
                Olalekan Ogunleye Newbie

                Yes you are right, I got that exception. Can you please tell me what I am doing wrong to get this exception and how to fix it. Thank you

                • 5. Re: Error Invoking Login Method - Help Please
                  Simon Kent Newbie

                  Well, the relevant part of that exception is actually


                  Caused by: java.lang.ClassCastException: za.co.csir.mobi4dadmin.entity.Userdb cannot be cast to za.co.csir.mobi4dadmin.session.User at za.co.csir.mobi4dadmin.session.Authenticator.authenticate(Authenticator.java:59) at


                  Just have a look at your
                  za.co.csir.mobi4dadmin.session.Authenticator.authenticate
                  on line 59.


                  This is a basic java language problem...

                  • 6. Re: Error Invoking Login Method - Help Please
                    Olalekan Ogunleye Newbie

                    Yeah Simon, in actual sense what is the cause of this problem and what does one do to overcome it

                    • 7. Re: Error Invoking Login Method - Help Please
                      Simon Kent Newbie

                      This is not a seam problem, but rather a basic java language problem.
                      I would help you, but you haven't posted the za.co.csir.mobi4dadmin.session.Authenticator.authenticate(Authenticator.java:59)
                      line of code, so that I can suggest a fix

                      • 8. Re: Error Invoking Login Method - Help Please
                        Olalekan Ogunleye Newbie
                        Hi Simon,

                        Please see below my Authenticator code. The underline code is my line 59. Can you please tell me what I am doing wrong. Thank you


                        package za.co.csir.mobi4dadmin.session;

                        import java.util.List;  //Added today

                        import javax.ejb.Stateless; //Added today
                        import javax.faces.application.FacesMessage;  //Added today
                        import javax.faces.context.FacesContext;  //Added today
                        import javax.persistence.EntityManager;  //Added today
                        import javax.persistence.PersistenceContext;  //Added today

                        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.Credentials;
                        import org.jboss.seam.security.Identity;  user = results.get(0);
                        import org.jboss.seam.annotations.Out;
                        import org.jboss.seam.contexts.Context;

                        @Stateless
                        @Name("authenticator")
                        public class Authenticator implements Authenticate
                        {
                            @Logger private Log log;

                            @In Identity identity;
                            @In Credentials credentials;
                           
                            @Out
                            public User user;
                           
                            @PersistenceContext
                            private EntityManager entityManager;
                           
                            @SuppressWarnings("unused")
                                @In
                            private transient Context sessionContext;
                            @In
                            private transient FacesContext facesContext;
                           

                            @SuppressWarnings("unchecked")
                                public boolean authenticate()
                            {
                                log.info("authenticating {0}", credentials.getUsername());
                                List <User> results=entityManager.createQuery("select u from Userdb u where username=:username and password=:password")
                                                 .setParameter("username", credentials.getUsername())
                                                 .setParameter("password", credentials.getPassword())
                                                 .getResultList();
                               
                                if (results.size()==0)
                                {
                                        facesContext.addMessage(null, new FacesMessage("Invalid login"));
                                        return false;
                                }
                               
                                else
                                {
                                      _  user = results.get(0);_
                                        identity.addRole("Visitor");
                                        return true;
                                }
                                //write your authentication logic here,
                                //return true if the authentication was
                                //successful, false otherwise
                                //if ("admin".equals(credentials.getUsername()))
                               // {
                                  //  identity.addRole("admin");
                                  //  return true;
                               // }
                               // return false;
                            }

                        }
                        • 9. Re: Error Invoking Login Method - Help Please
                          Simon Kent Newbie
                          In don't know what line in the above is 59.

                          However,

                          List <User> results=entityManager.createQuery("select u from Userdb u where username=:username and password=:password")

                          obviously is not going to work, since you are retrieving a list of Userdb objects, and you are trying to cast it to a list of User objects.
                          • 10. Re: Error Invoking Login Method - Help Please
                            Olalekan Ogunleye Newbie
                            user = results.get(0);

                            That is line 59. However, can you please tell me what to do in that code which you have shown me know. I am new to Seam and I was trying to follow the booking example. Thank you
                            • 11. Re: Error Invoking Login Method - Help Please
                              Simon Kent Newbie
                              change declaration
                              public User user;
                              into
                              public Userdb user;

                              also change
                              List <User> results
                              into
                              List <Userdb> results
                              • 12. Re: Error Invoking Login Method - Help Please
                                Olalekan Ogunleye Newbie
                                Thank you for your help simon. However after I did what you said I got another error. See the error log below. I have tried to comment out the @Out but I still get the same error. Can you please tell me what I am doing wrong. This is my error log as well as my code for Authenticator Code below. Any help would be appreciated.


                                08:05:46,354 WARN  [SeamLoginModule] Error invoking login method
                                javax.el.ELException: javax.ejb.EJBTransactionRolledbackException: attempted to bind an @Out attribute of the wrong type to: authenticator.user
                                     at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:339)
                                     at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
                                     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:175)
                                     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:597)
                                     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:344)
                                     at org.jboss.seam.security.Identity.authenticate(Identity.java:332)
                                     at org.jboss.seam.security.Identity.login(Identity.java:259)
                                     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:597)
                                     at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
                                     at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
                                     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 com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                                     at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
                                     at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                                     at javax.faces.component.UICommand.broadcast(UICommand.java:387)
                                     at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
                                     at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
                                     at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
                                     at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
                                     at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
                                     at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                                     at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                                     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                                     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.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                     at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                                     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:206)
                                     at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                                     at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
                                     at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
                                     at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                     at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
                                     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                     at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
                                     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:182)
                                     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                                     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                                     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                                     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                                     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:262)
                                     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                                     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                                     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                                     at java.lang.Thread.run(Thread.java:619)
                                Caused by: javax.ejb.EJBTransactionRolledbackException: attempted to bind an @Out attribute of the wrong type to: authenticator.user
                                     at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
                                     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:95)
                                     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:110)
                                     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                     at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                                     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:240)
                                     at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
                                     at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
                                     at $Proxy147.authenticate(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:597)
                                     at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                                     at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
                                     at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
                                     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                                     at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                                     at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
                                     at org.javassist.tmp.java.lang.Object_$$_javassist_seam_2.authenticate(Object_$$_javassist_seam_2.java)
                                     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:597)
                                     at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
                                     ... 81 more
                                Caused by: java.lang.IllegalArgumentException: attempted to bind an @Out attribute of the wrong type to: authenticator.user
                                     at org.jboss.seam.Component.outjectAttribute(Component.java:1779)
                                     at org.jboss.seam.Component.outjectAttributes(Component.java:1755)
                                     at org.jboss.seam.Component.outject(Component.java:1608)
                                     at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:86)
                                     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                     at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                                     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                     at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:29)
                                     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                     at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:30)
                                     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                     at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                                     at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
                                     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:597)
                                     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:47)
                                     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                     at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                                     ... 114 more



                                My Authenticator Code

                                package za.co.csir.mobi4dadmin.session;

                                import java.util.List;  //Added today

                                import javax.ejb.Stateless; //Added today
                                import javax.faces.application.FacesMessage;  //Added today
                                import javax.faces.context.FacesContext;  //Added today
                                import javax.persistence.EntityManager;  //Added today
                                import javax.persistence.PersistenceContext;  //Added today

                                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.Credentials;
                                import org.jboss.seam.security.Identity;
                                //import org.jboss.seam.annotations.Out;
                                import org.jboss.seam.contexts.Context;

                                import za.co.csir.mobi4dadmin.entity.Userdb;

                                @Stateless
                                @Name("authenticator")
                                public class Authenticator implements Authenticate
                                {
                                    @Logger private Log log;

                                    @In Identity identity;
                                    @In Credentials credentials;
                                   
                                    //@Out
                                    public Userdb user;
                                   
                                    @PersistenceContext
                                    private EntityManager entityManager;
                                   
                                    @SuppressWarnings("unused")
                                     @In
                                    private transient Context sessionContext;
                                    @In
                                    private transient FacesContext facesContext;
                                   

                                    @SuppressWarnings("unchecked")
                                     public boolean authenticate()
                                    {
                                        log.info("authenticating {0}", credentials.getUsername());
                                        List <Userdb> results = entityManager.createQuery("select u from Userdb u where username=:username and password=:password")
                                                   .setParameter("username", credentials.getUsername())
                                                   .setParameter("password", credentials.getPassword())
                                                   .getResultList();
                                       
                                        if (results.size()==0)
                                        {
                                             facesContext.addMessage(null, new FacesMessage("Incorrect login"));
                                             return false;
                                        }
                                       
                                        else
                                        {
                                             user = results.get(0);
                                             identity.addRole("Visitor");
                                             return true;
                                        }
                                        //write your authentication logic here,
                                        //return true if the authentication was
                                        //successful, false otherwise
                                        //if ("admin".equals(credentials.getUsername()))
                                       // {
                                          //  identity.addRole("admin");
                                          //  return true;
                                       // }
                                       // return false;
                                    }

                                }