0 Replies Latest reply on Sep 18, 2014 9:22 AM by claudinei

    No EJB found with interface of type when not using @Local

    claudinei Newbie

      I have the following structure:




          public class BaseDAO<T> {
              @PersistenceContext(unitName = Constant.PU)
              private transient EntityManager em;
              private final Class<T> type;
              public BaseDAO() {
                  type = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];




              public interface AbstractDAO<T extends Serializable, K> {
                  void save(T entity) throws ObjectEmptyException, FieldInvalidException, ObjectExistsException;
                  //others CRUD methods




          public abstract class AbstractDAOImpl<T extends Serializable, K> extends BaseDAO<T> implements AbstractDAO<T, K> {
               * Instância para o log4j.
              private static final Logger LOGGER = Logger.getLogger(AbstractDAOImpl.class);
              public void save(final T entity) throws ObjectEmptyException, FieldInvalidException, ObjectExistsException {
              //Others CRUD methods


      Then the DAOs:


         public interface TaxDAO extends AbstractDAO<Tax, Long> {




          public class TaxDAOImpl extends AbstractDAOImpl<Tax, Long> implements TaxDAO {
          //Implementations Go here


      When I use @EJB in myService like this:


          private TaxDAO taxDAO;


      Without @Local in DAO class I got this error in Wildfly 8.1:


         Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014544: No EJB found with interface of type 'br.com.zzz.erp.ejb.dao.domain.TaxDAO' for binding br.com.zzz.erp.ejb.service.domain.impl.TaxServiceImpl/taxDAO"}


      When setting annotation @Local in the DAO all works, but the others DAOs with the same code structure in project does not uses Local and works too, only newly created DAOs have this problem.

      Why this happens there is some container limit?

      The good practice is to always annotate @Local?