1 Reply Latest reply on Aug 9, 2014 12:44 PM by juanmiguelbg

    problemme with injecting ejb3 stateless component on seam component

    fayssaltahtoub

      i have a some problemes with injecting of an ejb3 component on seam component here is my class description :

      1- i have a generic class called GenericDAO :

      package org.escolarite.database.persistance.dao;  import java.io.Serializable; import java.util.List; import java.util.Map; import java.util.Map.Entry;  import javax.ejb.Local; import javax.ejb.Stateless; import javax.persistence.*; import javax.persistence.criteria.CriteriaQuery;  import org.jboss.seam.annotations.Logger; import org.jboss.seam.log.Log;   @Stateless public abstract class GenericDAO<T> implements Serializable {  @PersistenceContext(unitName="escolarite") private EntityManager entityManager;  @Logger Log log;  private static final long serialVersionUID = 1L;  private Class<T> refClass;  public GenericDAO(){  }  //some code here .....  }

      2- there is an other class that extends from GenericDAO called RequestDAO :

      package org.escolarite.database.persistance.dao;  import java.util.Hashtable; import java.util.List; import java.util.Map;  import javax.ejb.Local; import javax.ejb.Stateless; import javax.persistence.Query;  import org.escolarite.database.persistance.entities.Request; import org.escolarite.database.persistance.entities.RequestType;  @Stateless public class RequestDAO extends GenericDAO<Request> {   public RequestDAO() { super(); }   }

      3- there is an other facade class that called RequestFacade :

      package org.escolarite.facades;  import java.util.List;  import javax.ejb.Stateless;  import org.escolarite.database.persistance.dao.RequestDAO; import org.escolarite.database.persistance.entities.Request; import org.escolarite.database.persistance.entities.RequestType; import org.jboss.seam.annotations.In;   // this class is used like a repository for the request Table/Object  @Stateless public class RequestFacade implements EscolariteFacadeInterface{  @In private RequestDAO requestDAO = null;  // some code here   }

      4- finally the facade class called from the seam component this component called HelloBean:

      package org.escolarite.session;  import javax.ejb.Stateless; import javax.faces.application.FacesMessage;  import org.escolarite.facades.RequestFacade; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Logger; import org.jboss.seam.annotations.Scope; import org.jboss.seam.log.Log;   @Name("hello") @Stateless public class HelloBean implements Hello { @Logger private Log log;  @In(create=true) private RequestFacade requestFacade;  public String hello() { // implement your business logic here log.info("Hello.hello() action called"); System.err.println("Counter "+requestFacade.findAll().size()); return "hello"; }  // add additional action methods  }

      the probleme is when i want to inject the facade ejb stateless component in the seam component it throw an exception.

      thnks for help