简体   繁体   中英

CDI @Inject throws NullPointerException on Websphere 8.5

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

在WAR中,beans.xml进入WEB-INF。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM