2 Replies Latest reply on Jun 7, 2009 12:07 AM by Pete Muir

    Injection @Logger

    Diego Coronel Apprentice

      Hey, im testing webBeans preview 1, i got this error:




      INFO: JPA services not available. Injection of @PersistenceContext will not occur. Entity beans will be discovered as simple beans.
      05/06/2009 22:05:03 org.apache.catalina.core.StandardContext listenerStart
      SEVERE: Exception sending context initialized event to listener instance of class org.jboss.webbeans.environment.servlet.Listener
      javax.inject.UnsatisfiedDependencyException: The injection point   Field @Logger private logger on Annotated class Class @SessionScoped @Named Authenticator
        Constructor public Authenticator();
        Method String public authenticate();
        Method boolean public isLogged();
        Method Usuario @Produces @LoggedUser public loggedUser();
        Method void public final wait();
        Method void public final wait(long, int);
        Method void public final native wait(long);
        Method int public native hashCode();
        Method Class public final native getClass();
        Method boolean public equals(Object);
        Method String public toString();
        Method void public final native notify();
        Method void public final native notifyAll();
       with binding types [@Logger] in Session scoped simple bean 'authenticator' com.fpf.login.Authenticator,  API types = [Serializable, Authenticator, Object], binding types = [@Current] has unsatisfied dependencies with binding types 
           at org.jboss.webbeans.BeanValidator.validate(BeanValidator.java:112)
           at org.jboss.webbeans.bootstrap.WebBeansBootstrap.boot(WebBeansBootstrap.java:207)
           at org.jboss.webbeans.environment.servlet.Listener.contextInitialized(Listener.java:132)
           at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
           at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
           at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
           at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
           at org.apache.catalina.core.StandardService.start(StandardService.java:516)
           at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
           at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
           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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
           at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
      05/06/2009 22:05:03 com.sun.faces.config.ConfigureListener contextInitialized
      INFO: Initializing Mojarra 2.0.0 (Beta1 b13) for context '/HelloWebBeans'
      05/06/2009 22:05:04 org.apache.catalina.core.StandardContext start



      my class:




      package com.fpf.login;
      
      import java.io.Serializable;
      
      import javax.annotation.Named;
      import javax.context.Conversation;
      import javax.context.SessionScoped;
      import javax.inject.Current;
      import javax.inject.Produces;
      import javax.inject.manager.Manager;
      
      import org.jboss.webbeans.log.Log;
      import org.jboss.webbeans.log.Logger;
      
      @Named
      @SessionScoped
      public class Authenticator implements Serializable {
           private static final long serialVersionUID = 1L;
           
           @Logger
           private Log logger;
           
           @Current
           private Credentials credentials;
           
           @Current 
           private Conversation conversation;
           
           @Current
           private Manager manager;
           
           public String authenticate() {
                logger.info( "executando authenticate" );
                if ( isLogged() ) {
                     logger.info( "logou com sucesso" );
                     conversation.begin();
                     manager.fireEvent( loggedUser() );
                     return "/login/login.xhtml";
                }
                logger.info( "nova tentativa de login" );
                return "tryAgain"; 
           }
           
           public boolean isLogged() {
                if ( credentials.getLogin() == null ) return false;
                
                return credentials.getLogin().equals(credentials.getPassword());
           }
           
           public @Produces @LoggedUser Usuario loggedUser() {
                logger.info( "Evento @LoggedUser executado" );
                if ( isLogged() ) { 
                     return new Usuario( credentials.getLogin() );
                }
                return null;
           }
      }



      but i dont know what to do... any help?