1 Reply Latest reply on Jun 14, 2013 1:15 PM by wdfink

    cdi @Inject throws NullPointerException on WebSphere 8.5

    fabiosss2003

      I've deployed an ear on websphere 8.5.

      the application is composed of an ejb jar and a webapp ( Spring MVC ).

      Here is my ejb :

          @Stateless public class DiscrepanciesServiceImpl implements DiscrepanciesService {  @Inject private DiscrepancyDao discrepancyDao;  public DiscrepanciesServiceImpl(){};  public List<Discrepancy> viewDiscrepancies() {  return discrepancyDao.findAll(); } 

      }

      discrepancyDao is an interface that extends a generics interface as follows:

         public interface DiscrepancyDao extends _GenericDao<Discrepancy> { 

      }

      implemented by DiscrepancyDaoImpl as follow:

              @Named("discrepancyDao") public class DiscrepancyDaoImpl extends _GenericDaoImpl<Discrepancy> implements  DiscrepancyDao {  } 

      and when I invoke viewDiscrepancies() i get nullpointerexception on discrepancyDao ( injected by CDI )

      I've deployed on WAS 8.5 and my empty beans.xml is in the META-INF folder. During the deployment the was's console works fine with no errors. Thanks in advance for your answers. Regards Fabio