1 Reply Latest reply on Oct 12, 2015 2:21 AM by Philippe Marschall

    HK2 Jersey CDI and WELD CDI coexistence

    Alessio Orlando Newbie

      hi to all,

      in my use case i developed a REST service layer for my application running in WildFly 9

      My requirement is to use Jersey 2.x... and this is done. My web.xml looks like this standard:



        <servlet-name>Jersey REST Service</servlet-name>









        <servlet-name>Jersey REST Service</servlet-name>




      My Rest services uses DAO built on JPA and would like to use JTA transaction manager.

      I've annotated the service with @Stateless annotation and then with @RequestScoped annotation


      @RequestScoped /@Stateless


      public class UserResourceRESTService {

        IMapUserDao mapUserDao = new MapUserDaoKasImpl(dataSourceJNDI);



      public List<BaseUser> listAllUsers() {

          List<BaseUser> users = null;

          try {

          users = mapUserDao.getAllUsers();


      And this the DAO


      @RequestScoped /@Stateless



      public class MapUserDaoKasImpl implements IMapUserDao  {


        UserTransaction useTransaction;


        EntityManagerFactory factory;

        protected MapUserDaoKasImpl()


        protected MapUserDaoKasImpl(String dataSourceJNDI){




      It seems @Resource annotation is never attached by weld and UserTransaction is alway NULL.

      It seems so tricky to use Jersey inside Wildfly. Why?

      What am i doing wrong?