@Martin's comment got me thinking about multiple threads part. I got this to work by:
- Ensuring that
ctx.lookup(...)
is invoked in theBundleActivator
. This is because, in the bridged mode, theClassLoader
of the thread running theActivator
code can look up all Classes and Resources that are defined in the parent WAR file. - Ensuring that the parent WAR's
META-INF/context.xml
exposes the JNDI resource via<ResourceLink global="foo/bar" name="foo/bar" type="javax.sql.DataSource"/>