On 23/01/2012 12:02, Carlo de Wolf wrote:
On 01/23/2012 12:58 PM, David Bosschaert wrote:
> Hi all,
>
> I'm looking at integrating the OSGi JNDI spec [1] with AS7.
> Implementations of this spec (which exposes OSGi services via JNDI to
> allow JavaEE integration) create a few javax.naming.spi.ObjectFactory
> instances to handle some additional namespaces, e.g. osgi:service lookups.
>
> To get this working with AS7 I can call
> org.jboss.as.naming.InitialContext.addUrlContextFactory(scheme,
> myObjectFactory)
> and that works fine.
>
> However, I'm curious, is there a non-JBoss-specific way to do this too
> (i.e. part of the JEE naming spec). If there is, I can make the Apache
> Aries OSGi-JNDI implementation call this directly and it would avoid the
> need for some AS7-specific glue code...
http://docs.oracle.com/javase/jndi/tutorial/beyond/url/initctx.html
Thanks Carlo.
From that it seems that the only way to do this in a standard manner is
by putting the relevant packages on the java.naming.factory.url.pkgs
system property. The system attempts to instantiate a class in those
packages. This is not modular by design and will not work.
Seems like those 5 lines of glue code are inevitable. It's not a big
problem, thanks for pointing this out.
Cheers,
David