wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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(CounterClient.java:30)

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: 17249

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
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
read: http://www.coderanch.com/t/318695/EJB-JEE/java/First-Bean

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: http://aspose.com/file-tools
subject: Problem with NamingContext in sessionClient
Similar Threads
file reading in applet
How to create web service in RAD7
How to put JDBC driver in applet jar?
Need help with this code
Please help me about deploy jboss