6 Replies Latest reply on Mar 11, 2009 1:04 AM by Odomitchi Anikpo

    Error invoking login method - javax.el.PropertyNotFoundException: Target Unreachable, identifier 'authenticator' resolved to null

    Odomitchi Anikpo Newbie
      I 'm using Seam 2.1.1GA with Tomcat6. I have followed the documentation to create a login page that uses Seam authentication (see code extract from componenets.xml, Authenticator.java and login.xhtml below). But When I submit the form I get the following error:

      ERROR [http-8080-6] (SeamLoginModule.java:113) - Error invoking login method
      javax.el.PropertyNotFoundException: Target Unreachable, identifier 'authenticator' resolved to null
              at org.jboss.el.parser.AstValue.getTarget(AstValue.java:38)
              at org.jboss.el.parser.AstValue.invoke(AstValue.java:95)
              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: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: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:585)
              at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
              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 com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
              at javax.faces.component._MethodExpressionToMethodBinding.invoke(_MethodExpressionToMethodBinding.java:78)
              at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:57)
              at javax.faces.component.UICommand.broadcast(UICommand.java:143)
              at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
              at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
              at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
              at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
              at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
              at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
              at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:151)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:532)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              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:178)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
              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:58)
              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.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
              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:447)
              at java.lang.Thread.run(Thread.java:595)


      My code:

      1) components.xml

      <security:identity authenticate-method="#{authenticator.authenticate}" remember-me="true"/>


      2) Authenticator.java

      `@Name("authenticator")
      public class Authenticator {
              @Logger
              Log log;

          @In
          Credentials credentials;

              @In
              Identity identity;

              public boolean authenticate() {
                      log.info("authenticating #0 ", credentials.getUsername());
              System.out.println("username " + credentials.getUsername() + " and password " + credentials.getPassword());
                      identity.addRole("admin");
                      return true;
              }
      }`



      3) login.xhtml
                               `
      <div class="dialog">
              <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
              <h:outputLabel for="username">Username</h:outputLabel>
              <h:inputText id="username" value="#{credentials.username}"/>
              <h:outputLabel for="password">Password</h:outputLabel>
              <h:inputSecret id="password" value="#{credentials.password}"/>
              <h:outputLabel for="rememberMe">Remember me</h:outputLabel>
              <h:selectBooleanCheckbox id="rememberMe" value="#{identity.rememberMe}"/>
              </h:panelGrid>
      </div>
      ...

      <div class="actionButtons">
      <h:commandButton id="login" value="Login" action="#{identity.login}"/>
      </div>
      `

      I review my code and can't seem to find where I have gone wrong neither. And I checked that my authenticator.java class is compiled and in the war file. I would very much appreciate any help (note I'm new to seam so any input even if it seems obvious to you will be helpful.  Thanks