Hello, all!
I'm currently developing a proof-of-concept application using OSGi bundles to deploy EJB's, API modules, etc. Everything is working as excepted and hoped with one rather uncomfortable exception: @EJB injections require the use of the full, portable JNDI lookup path for the EJBs being injected. These is the code injection snippet:
@EJB(lookup = "some-full-blown-portable-jndi-path")
@OSGiService
private MyEJB ejb;
The EJB declaration has a @Local annotation pointing to the @Local interface (I already tried it with @Remote and there were many more problems - including a ridiculous one where an EJB implementation class was expected to subclass java.rmi.Remote...this violates specs as I recall):
@Stateless
@Local(MyEJB.class)
public class MyEJB_Impl implements MyEJB {
/* bla bla bla... */
}
So...these are the symptoms:
- if I remove the lookup parameter, then lookup of the EJB fails miserably because it's sought-after using the non-portable JNDI name
- using ejb-ref mappings in either web.xml or glassfish-web.xml also did not work.
- Remote interfaces did not work (@Remote)
My question is this: what is required in order to remove the full JNDI lookup path? This path is obviously problematic since it includes the bundle name and version. The point is to be able to transparently replace the EJB implementation transparently, and thus the need is to be able to inject that EJB with as little information as possible (especially without information tying it to a specific implementation).
Any ideas? Suggestions?
FYI: evidently, if I bundle everything as a single WAR, everything works flawlessly with "magical" injection of EJB's, but the idea here is to do that using OSGi.
Thanks for your time!