[jboss-user] [EJB3] - Access EJB from different WAR in JBoss AS via injection

charlie7 do-not-reply at jboss.com
Mon May 13 12:18:06 EDT 2013


charlie7 [https://community.jboss.org/people/charlie7] created the discussion

"Access EJB from different WAR in JBoss AS via injection"

To view the discussion, visit: https://community.jboss.org/message/817451#817451

--------------------------------------------------------------
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  http://www.verborgh.be/articles/2010/01/06/porting-the-viewscoped-jsf-annotation-to-cdi 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
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/817451#817451]

Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130513/e20969da/attachment.html 


More information about the jboss-user mailing list