cancel
Showing results for 
Search instead for 
Did you mean: 

JNDI InitialContext

Former Member
0 Kudos

Hi all,

I am trying to obtain a jndi Context with the following method:


public static Context getInitialContext() throws javax.naming.NamingException {
		Properties props = new Properties();
		props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
		props.put(Context.PROVIDER_URL, "localhost:50004");
		Context jndiContext = new InitialContext(props);
		return jndiContext;
	}

When I execute the code from an external client I get the following exception:


javax.naming.NoInitialContextException: Cannot instantiate class: com.sap.engine.services.jndi.InitialContextFactoryImpl [Root exception is java.lang.ClassNotFoundException: com.sap.engine.services.jndi.InitialContextFactoryImpl]
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
...

Any ideas? Thanks,

Arne

Accepted Solutions (1)

Accepted Solutions (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Arne,

Seems your client doesn't have the required jars on its classpath. You need the following: sapj2eeclient.jar, exception.jar, logging.jar from /usr/sap/<SID>/<instance>/j2ee/j2eeclient.

HTH!

-Vladimir

Answers (0)