File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Problem with NamingContext in sessionClient Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Problem with NamingContext in sessionClient" Watch "Problem with NamingContext in sessionClient" New topic

Problem with NamingContext in sessionClient

saran sadaiyappan
Ranch Hand

Joined: Dec 23, 2004
Posts: 39
I have written a client to call a session bean. I am loading the initial context and provider url as


But I get a exception as,

javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContext [Root exception is java.lang.InstantiationException: org.jnp.interfaces.NamingContext]
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at slsb.CounterClient.main(

But I have loaded the jar file jnp-client.jar in the classpath. ANy idea why this happens?
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Instead of using a -D command line option, why not include a file instead. Then let's go from there.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
saran sadaiyappan
Ranch Hand

Joined: Dec 23, 2004
Posts: 39
I dont think its related to reading them. But the problem is with loading them. Anyways I did it..still the same
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847

You're right in setting commandline options but you're setting the wrong ones.
Setting properties inside the application is a bad idea, it makes your application too tightly linked with a specific server implementation and location.

I agree. Here's the link:
subject: Problem with NamingContext in sessionClient
jQuery in Action, 3rd edition