3 Replies Latest reply on Oct 31, 2012 10:13 AM by mkouba

    Inject  org.jboss.logging.Logger into my classes

    deibys

      Hello guys,

       

      I have been struggling soith something I guess is very simple, but I am clueless about what could be happening

       

      I want to inject the Logger class into my classes

       

      So I have this as my producer class:

       

       

      package org.colfuturo.cdi;
      
      
      import javax.enterprise.inject.Produces;
      import javax.enterprise.inject.spi.InjectionPoint;
      
      
      import org.jboss.logging.Logger;
      
      
      public class Loggers {
          
          @Produces
          public static Logger getLogger(InjectionPoint injectionPoint) {
              return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getSimpleName());
          }
          
      }
      
      

       

      And I have My Backing Bean ( JSF 2 where I want to inject the logger )

       

       

      package org.colfuturo.eventos.interno.web.bean;
      
      
      import java.io.Serializable;
      import java.util.ArrayList;
      import java.util.List;
      
      
      import javax.faces.application.FacesMessage;
      import javax.faces.bean.ManagedBean;
      import javax.faces.bean.SessionScoped;
      import javax.faces.context.FacesContext;
      import javax.inject.Inject;
      
      
      import org.colfuturo.eventos.business.entities.PlantillaMensaje;
      import org.colfuturo.eventos.interno.web.delegate.EventosInternoDelegate;
      import org.colfuturo.eventos.interno.web.delegate.MailDelegate;
      import org.colfuturo.eventos.interno.web.delegate.PlantillaMensajeDelegate;
      import org.colfuturo.eventos.model.to.EmailAttachmentTO;
      import org.colfuturo.eventos.model.to.EmailTO;
      import org.colfuturo.eventos.model.to.EventoTO;
      import org.colfuturo.eventos.model.to.TipoMensajeTO;
      import org.colfuturo.model.to.ListaTO;
      import org.jboss.logging.Logger;
      import org.richfaces.event.FileUploadEvent;
      import org.richfaces.model.UploadedFile;
      
      
      /**
       * Managed Bean para el manejo de las interfaces de Difusion de Eventos
       * @author Deibys Quintero
       * 
       */
      // @ManagedBean(name = "DifundirEventoBean")
      @ManagedBean( name = "DifundirEventoBean")
      @SessionScoped
      public class DifundirEventoBean implements Serializable {
          
          @Inject Logger logger;
      
      

       

      and I get the folloging exception when doing deployement:

       

       

      15:08:19,004 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016008: Starting weld service for deployment Eventos-Interno.war
      15:08:19,469 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."Eventos-Interno.war"
      .WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."Eventos-Interno.war".WeldService: org.jboss.weld.exceptions.Deplo
      ymentException: WELD-001408 Unsatisfied dependencies for type [Logger] with qualifiers [@Default] at injection point [[field] @Inject org.colfuturo.ev
      entos.interno.web.bean.DifundirEventoBean.logger]
              at org.jboss.as.weld.services.WeldService.start(WeldService.java:83)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_33]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_33]
              at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_33]
      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Logger] with qualifiers [@Default] at injecti
      on point [[field] @Inject org.colfuturo.eventos.interno.web.bean.DifundirEventoBean.logger]
              at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:275)
              at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:244)
              at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:107)
              at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:127)
              at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:346)
              at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:331)
              at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)
              at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83)
              at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)
              ... 5 more
      
      
      15:08:19,517 INFO  [org.jboss.as] (MSC service thread 1-7) JBAS015951: Admin console listening on http://127.0.0.1:9990
      15:08:19,519 ERROR [org.jboss.as] (MSC service thread 1-7) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 7201ms - Started 323 of
       574 services (172 services failed or missing dependencies, 77 services are passive or on-demand)
      15:08:19,719 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "Eventos-Interno.war" was rolled back with f
      ailure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"Eventos-Interno.war\".WeldService" => "org.jboss.msc.service.StartException
       in service jboss.deployment.unit.\"Eventos-Interno.war\".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependen
      cies for type [Logger] with qualifiers [@Default] at injection point [[field] @Inject org.colfuturo.eventos.interno.web.bean.DifundirEventoBean.logger
      ]"}}
      15:08:19,759 INFO  [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011403: Stopping Persistence Unit Service 'Eventos-Interno.war#entityManager'
      15:08:19,890 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment Eventos-Interno.war in 170ms
      15:08:19,892 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
      JBAS014777:   Services which failed to start:      service jboss.deployment.unit."Eventos-Interno.war".WeldService: org.jboss.msc.service.StartExcepti
      on in service jboss.deployment.unit."Eventos-Interno.war".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependen
      cies for type [Logger] with qualifiers [@Default] at injection point [[field] @Inject org.colfuturo.eventos.interno.web.bean.DifundirEventoBean.logger
      ]
      
      
      15:08:19,907 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled ba
      ck. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"Eventos-Interno.war\".WeldService" => "o
      rg.jboss.msc.service.StartException in service jboss.deployment.unit.\"Eventos-Interno.war\".WeldService: org.jboss.weld.exceptions.DeploymentExceptio
      n: WELD-001408 Unsatisfied dependencies for type [Logger] with qualifiers [@Default] at injection point [[field] @Inject org.colfuturo.eventos.interno
      .web.bean.DifundirEventoBean.logger]"}}}}
      
      

       

      What am I missing ?