1 Reply Latest reply on Dec 2, 2010 3:38 AM by Jan Groth

    Weld sl4j Logger Injection

    Paata Lominadze Newbie

      Hello,
      I'm trying to inject sl4j logger into my Singleton Session Bean.


      Code :




      import java.util.ArrayList;
      
      import javax.annotation.PostConstruct;
      import javax.ejb.Singleton;
      import javax.ejb.Startup;
      import javax.inject.Inject;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      
      import org.slf4j.Logger;
      
      import com.magti.billing.customercare.usemanagement.beans.entity.User;
      
      /**
       * Session Bean implementation class UserManagerFascade
       */
      @Singleton(mappedName = "UserManagerFascade")
      @Startup
      public class UserManagerFascade implements UserManagerFascadeRemote,
                UserManagerFascadeLocal {
      
           private @Inject Logger logger;
      
           @PersistenceContext(unitName = "Oracle")
           private EntityManager oracleManager;
      
           private ArrayList<User> users;
      
           @SuppressWarnings({ "unused", "unchecked" })
           @PostConstruct
           private void startup() {
                try {          
                     logger.info("Retrieving Users From Database ... ");
                     users = (ArrayList<User>) oracleManager.createNamedQuery(
                               "Users.findAll").getResultList();
                     logger.info("Retrieving Users From Database Finished Successfully.");
                } catch (Exception e) {
                     e.printStackTrace();
                     logger.info("Retrieving Users From Database Finished Successfully.");
                }
           }
      
           public ArrayList<User> getUsers() {
                return users;
           }
      }
      



      My Env. :
      JBoss Application Server : jboss-6.0.0.20101110-CR1


      Documentation URL


      But I've this error :


      19:17:22,180 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=vfs:///home/paata/InstalledPrograms/JBossAS/jboss-6.0.0.20101110-CR1/server/all/deploy/CustomerCare.ear_WeldBootstrapBean state=Create: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Logger] with qualifiers [@Default] at injection point [[field] @Inject private com.magti.billing.customercare.usemanagement.UserManagerFascade.logger]
              at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:284) [:6.0.0.20101110-CR1]
              at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:134) [:6.0.0.20101110-CR1]
              at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:153) [:6.0.0.20101110-CR1]
              at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:356) [:6.0.0.20101110-CR1]
              at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:342) [:6.0.0.20101110-CR1]
              at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:383) [:6.0.0.20101110-CR1]
              at org.jboss.weld.integration.deployer.env.helpers.BootstrapBean.boot(BootstrapBean.java:92) [:6.0.0.20101110-CR1]
      
      




      Any Idea ?


      Did I miss something ?





      Regards,


      Paata Lominadze.