THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
 
  Apache ServiceMix NMR #usernavbar() #printableicon() #feedicon()  
When you contribute content to this Wiki, you grant a license to the ASF for inclusion in ASF works (as per the Apache Software License).
  7. JNDI integration

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 129 Next »

7. JNDI integration

ServiceMix NMR includes a JNDI / OSGi integration based on OSGi RFC-0142.

Creating the InitialContext

No specific setup is need to create the InitialContext:

Context ctx = new InitialContext();

The default context is a writable JNDI tree.

Accessing OSGi services

From the InitialContext, you can retrieve OSGi services using the following syntax:

osgi:services/<interface>[/<filter>]

For example:

InitialContext context = new InitialContext();
ExampleService = (ExampleService) context.lookup("osgi:services/com.example.ExampleService");

Naming SPI

The JNDI integration uses the OSGi registry to lookup a javax.naming.spi.InitialContextFactoryBuilder. If you want to use another provider for JNDI, you need to register such a service in the OSGi registry.

Note that in all cases, OSGi services will be available using the osgi:services/ URL.

#top

  • No labels