2 Replies Latest reply on May 14, 2013 6:28 AM by charlie7

    Access EJB from different WAR in JBoss AS via injection

    charlie7

      My Project structure is as follows

      JBoss AS 7.1.3.Final-redhat-4

      A war VWeb.war which contains an EJB , when VWeb is deployed I get the following

       

      java:global/VWeb/QServiceImpl!com.vi.qciapi.QService

      java:app/VWeb/QServiceImpl!com.vi.qciapi.QService

      java:module/QServiceImpl!com.vi.qciapi.QService

      java:global/VWeb/QServiceImpl

      java:app/VWeb/QServiceImpl

      java:module/QServiceImpl

       

      I have got another war (ControlWeb-portlet.war) which is a liferay project and I am trying to access the above EJB within a bean from ControlWeb-portlet . The bean is @ViewScoped This has been done based on a link found here

      I have tried all these combinations but nothing seems to work

       

      @Inject
      QService qService;

      @EJB
      QService qService;

      @EJB(mappedName="java:global/VWeb/QServiceImpl!com.vi.qciapi.QService")
      QService qService;

      @EJB(beanInterface=QService.class)
      QService qService;

      @EJB(mappedName="java:global/VWeb/QServiceImpl!com.vi.qciapi.QService")
      QService qService;

       

      I kept an EJB in the same project ControlWeb-portlet which is deployed as follows

       

          java:global/ControlWeb-portlet/CdiServiceImpl!com.clink.cdi.CdiServiceImpl

          java:app/ControlWeb-portlet/CdiServiceImpl!com.clink.cdi.CdiServiceImpl

          java:module/CdiServiceImpl!com.clink.cdi.CdiServiceImpl

          java:global/ControlWeb-portlet/CdiServiceImpl

          java:app/ControlWeb-portlet/CdiServiceImpl

          java:module/CdiServiceImpl

       

      and I am able to inject the EJB with

       

      @EJB
      CdiServiceImpl cdiServiceImpl;

      Is there anything specific that I have to while accessing an EJB from a different WAR

       

      Thanks in advance

      Charlie