From everything I have read on the web, when I register a service using the BundleContext.registerService() in a BundleActivator.start() method, in an OSGi bundle deployed to a glassfish server (I'm using v3.0.1b18), the service is supposed to be registered in JNDI so that I can use resource injection in a servlet (via @Resource). In fact, it seems that the services are NOT being registered in JNDI (as the name lookup fails, and browsing the JNDI tree confirms). If I register the services manually, then the @Resource injection works as it should.
Is this a bug or do I need some special OSGi module installed to realize this behavior? Does this ONLY happen when using declarative services or spring? Shouldn't it work with manual registrations too?
See
http://blogs.sun.com/dochez/entry/glassfish_v3_extensions_part_3 and
http://blogs.sun.com/dochez/entry/glassfish_v3_extensions_part_4
Thanks in advance.
[Message sent by forum member 'npahucki']
http://forums.java.net/jive/thread.jspa?messageID=469987