1 Reply Latest reply on Dec 18, 2007 6:26 PM by Tony Mai

    identifier 'authenticator' resolved to null

    Tony Mai Apprentice

      Hello all,

      I am trying to migrate my apps to Seam 2.0GA. Somehow, I am running into an exception where Seam could not look up my authenticator.

      So I created a new project with plain pages. I run into the same problem.

      Please help!

      Here is the exception in the log

      10:28:51,875 INFO [EARDeployer] Started J2EE application: file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/
      10:28:51,953 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
      10:28:51,984 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
      10:28:52,250 INFO [Server] JBoss (MX MicroKernel) [4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)] Started in 35s:266ms
      10:29:57,046 INFO [Contexts] starting up: org.jboss.seam.security.identity
      10:29:57,781 INFO [RuleBase] parsing rules: /security.drl
      10:29:58,078 INFO [Contexts] starting up: org.jboss.seam.web.session
      10:29:58,671 ERROR [STDERR] Dec 18, 2007 10:29:58 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/marketdesk_wui.war/WEB-INF/lib/jboss-seam-mail.jar!/META-INF/seam-mail.taglib.xml
      10:29:58,687 ERROR [STDERR] Dec 18, 2007 10:29:58 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/marketdesk_wui.war/WEB-INF/lib/jboss-seam-pdf.jar!/META-INF/seam-pdf.taglib.xml
      10:29:58,703 ERROR [STDERR] Dec 18, 2007 10:29:58 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/marketdesk_wui.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/s.taglib.xml
      10:29:58,734 ERROR [STDERR] Dec 18, 2007 10:29:58 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/marketdesk_wui.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
      10:29:58,750 ERROR [STDERR] Dec 18, 2007 10:29:58 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/marketdesk_wui.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
      10:29:58,765 ERROR [STDERR] Dec 18, 2007 10:29:58 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/marketdesk_wui.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
      10:29:58,781 ERROR [STDERR] Dec 18, 2007 10:29:58 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/marketdesk_wui.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
      10:29:58,828 ERROR [STDERR] Dec 18, 2007 10:29:58 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/marketdesk_wui.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
      10:29:58,859 ERROR [STDERR] Dec 18, 2007 10:29:58 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/marketdesk_wui.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/a4j.taglib.xml
      10:29:58,875 ERROR [STDERR] Dec 18, 2007 10:29:58 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/marketdesk_wui.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/ajax4jsf.taglib.xml
      10:29:58,906 ERROR [STDERR] Dec 18, 2007 10:29:58 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/marketdesk_wui.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/rich.taglib.xml
      10:29:58,937 ERROR [STDERR] Dec 18, 2007 10:29:58 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/JudoFS/server/jboss-4.2.1.GA/server/default/deploy/marketdesk_wui.ear/marketdesk_wui.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/richfaces.taglib.xml
      10:32:07,187 ERROR [SeamLoginModule] 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:174)
      at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:108)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at javax.security.auth.login.LoginContext.invoke(Unknown Source)
      at javax.security.auth.login.LoginContext.access$000(Unknown Source)
      at javax.security.auth.login.LoginContext$5.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.login.LoginContext.invokeCreatorPriv(Unknown Source)
      at javax.security.auth.login.LoginContext.login(Unknown Source)
      at org.jboss.seam.security.Identity.authenticate(Identity.java:335)


      My login page is as followed (straight from seam gen):
      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition 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:h="http://java.sun.com/jsf/html"
       xmlns:rich="http://richfaces.org/rich"
       template="layout/template.xhtml">
      
      <ui:define name="body">
      
       <h:messages styleClass="message"/>
      
       <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>
      
       </ui:define>
      </ui:composition>


      And my pages.xml is modified as follow:
      <page view-id="/login.xhtml">
       <navigation from-action="#{authenticator.checkIfLogedIn}">
       <rule if="#{identity.loggedIn}">
       <redirect view-id="/home.xhtml" />
       </rule>
       </navigation>
       <!-- Upon successful login, redirect to pending orders page -->
       <navigation from-action="#{identity.login}">
       <rule if="#{identity.loggedIn}">
       <redirect view-id="/home.xhtml" />
       </rule>
       <rule if-outcome="home">
       <redirect view-id="/home.xhtml" />
       </rule>
       </navigation>
       </page>
      
       <page view-id="*">
       <!-- After logged out, redisplay the login page -->
       <navigation from-action="#{identity.logout}">
       <redirect view-id="/login.xhtml" />
       </navigation>
       <!-- If application returns "home", redirect to pending orders page -->
       <navigation>
       <rule if-outcome="home">
       <redirect view-id="/home.xhtml" />
       </rule>
      ...


      And my authenticator is (again, straight from seam gen)
      package com.judofs.brokerage.marketdesk.action;
      
      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 {
       private @Logger Log log;
      
       private @In Identity identity;
      
       public boolean authenticate()
       {
       log.info("authenticating #0", identity.getUsername());
       //write your authentication logic here,
       //return true if the authentication was
       //successful, false otherwise
       identity.addRole("admin");
       return true;
       }
      }


      Thanks in advance for your help.
      -Tony