users@glassfish.java.net

Re: OSGi EJB injection requires full JNDI path lookup

From: <forums_at_java.net>
Date: Thu, 2 May 2013 15:38:33 -0500 (CDT)

For the sake of thoroughness, I have another question. Let's assume that for
reasons that can't be changed, it's not feasible to migrate the application
from a WAR into a WAB (humor me here). Let's say that we still have to
conusme those OSGi-fied EJB services from within the application, and we wish
to do it using injection of one sort or another (could be @EJB, could be
@Inject, whatever - the important point is the near-transparent injection),
or at least some mechanism that would facilitate such injection (could be a
custom, OSGi-aware producer class pattern). In my original problem I was able
to achieve this using @EJB, but I had to "somehow" specify the exact JNDI
lookup path of the exported EJB service (either in the @EJB annotation
itself, or via elements in web.xml). The idea would be to avoid such granular
"service location" specifications anywhere, since they can change without
notice (that's the whole point). How can I consume an OSGi service from a
"non-OSGi-aware" WAR file? Do I have to resort to doing it manually via the
OSGi API's? If so, how would I correctly identify *which* of the services to
inject (most likely through additional annotations, but still)? Any insights
you can share here will be greatly appreciated.

--
[Message sent by forum member 'drivera']
View Post: http://forums.java.net/node/896631