cancel
Showing results for 
Search instead for 
Did you mean: 

EJB lookup Error

Former Member
0 Kudos

Hi All

I m trying to loookup an EJB that is in the same server as my java Client.

I added all the related jars in the build path.and followed the weblogs but i am getting an error related to Initial Context of com.sap.engine.services.jndi.InitialContextFactoryImpl.

<u>ERROR</u>

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:652)

at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)

at javax.naming.InitialContext.init(InitialContext.java:219)

at javax.naming.InitialContext.<init>(InitialContext.java:195)

at com.chevron.ccs.mapping.Mapping.main(Mapping.java:96)

Caused by: java.lang.ClassNotFoundException: com.sap.engine.services.jndi.InitialContextFactoryImpl

at java.net.URLClassLoader$1.run(URLClassLoader.java:199)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:187)

at java.lang.ClassLoader.loadClass(ClassLoader.java:289)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)

at java.lang.ClassLoader.loadClass(ClassLoader.java:235)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:219)

at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)

at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)

... 4 more

Am i missing any point???

Thanks in Advance

DhanyaR Nair

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You should add com.sap.engine.services.jndi.InitialContextFactoryImpl class in your client classpath.

(this class you can find in the sapj2eeclient.jar)

Andrei Smolkin

EPAM Systems

<a href="http://www.NetWeaverTeam.com/">http://www.NetWeaverTeam.com/</a>

Former Member
0 Kudos

<b>Hi Andrei</b>

<b>I had already added this jar. Once i rebuild my project it get removed from the build path and gives the same error again.

If without building i just run the project after adding this jar , it gives the following error:</b>

javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)

at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)

at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)

at javax.naming.InitialContext.lookup(InitialContext.java:347)

at com.chevron.ccs.mapping.Mapping.main(Mapping.java:101)

<b>What do u think i m missing here?

Provide ur valuable suggessions.</b>

<b>Thanks In Advance

DhanyaR Nair</b>

Former Member
0 Kudos

Hi,

It means that you should add next lines in your code when you create initial context:

Hashtable prop = new Hashtable();

prop.put("java.naming.factory.initial", "com.sap.engine.services.jndi.InitialContextFactoryImpl");

InitialContext context = new InitialContext(prop);

Andrei Smolkin

EPAM Systems

<a href="http://www.NetWeaverTeam.com/">http://www.NetWeaverTeam.com/</a>

Former Member
0 Kudos

Hi frndz

Finally Ejb Lookup is completed successfully .

Thankyou verymuch. The problem was with the corrupted jar ,due to which the java client was throwing error.

Regards

DhanyaR Nair

Message was edited by: DhanyaR Nair

Answers (0)