cancel
Showing results for 
Search instead for 
Did you mean: 

JNDI Help!

Former Member
0 Kudos

From a web dynpro application I am trying to connection to a thrid party application that lives on a JBOSS server. The third party application requires me to set the JDNI properties as specified below.

I am not too familiar with JDNI and keep an error that the initial context could not be found.

My question is mainly about the first JDNI property. If I am setting java.naming.factory.initial to org.jnp.interfaces.NameingContextFactory, does my sap j2ee server need some special library to call this type of JDNI inital context? Or do I have to use a sap context factory type like "com.sap.engine.services.jndi.InitialContextFactoryImpl"

Again I'm not too familiar with JNDI but have been reading alot about it, so any help or experience with this would be appreciated.

JDNI Properties:

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

java.naming.provider.url=jnp://tybw202021:1099

java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

thanks,

Tom

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

You need to do something like this in your code:

Properties props = new Properties();

props.put( Context.PROVIDER_URL, "tybw202021:1099" );

props.put( Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );

Context ctx = new InitialContext( props );

if( ctx == null )

throw new Exception( "Failed to create context" );

Object o = ctx.lookup( "some/path/to/bean" );

(and then narrow the reference down, etc, etc).

I'm not sure what you would have to do with the java.naming.factory.url.pkgs - the docs for the Context interface might have more information on what key you should use - probably URL_PKG_PREFIXES.

Hope that helps you out!