wood burning stoves
The moose likes EJB and other Java EE Technologies and the fly likes Head First EJB - JNDI Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Head First EJB - JNDI Error" Watch "Head First EJB - JNDI Error" New topic

Head First EJB - JNDI Error

Ron Khera

Joined: Jun 27, 2005
Posts: 4
I am using the Head First EJB book. I can't seem to get the AdviceClient code running. All the code for the Advice example compiles and I have sucessfully deployed the EJB. The error seems to be with the initialContext object properties. I not familiar with JNDI and would appreciate some help.

C:\Projects\advice>java -classpath /projects/advice/AdviceAppClient.jar;. AdviceClient
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet pa
rameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at AdviceClient.go(AdviceClient.java:16)
at AdviceClient.main(AdviceClient.java:10)

Thanks !!
Ron Khera (SCJP)
Annie Smith
Ranch Hand

Joined: Mar 05, 2005
Posts: 172
You will need to specify the INTIAL_CONTEXT_FACTORY and the PROVIDER_URL for the InitialContext. That's what the exception trace is suggesting.

Also, if you are using Sun App server, you might take a look at the documentation.

Cheers!<br /><b>Annie</b>
I agree. Here's the link: http://aspose.com/file-tools
subject: Head First EJB - JNDI Error
It's not a secret anymore!