Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Starting EJB..JNDI exception

 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have just started preparing for the exam and the 1st program I have written is giving problems.
This is the exception I get when I run the client code,

javax.naming.NoInitialContextException: Need to specify class name in environmen
t or system property, or as an applet parameter, or in an application resource f
ile: 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:36)
at AdviceClient.main(AdviceClient.java:28)

I am using the Head First book and this is the advice project from the 2nd chapter.

If anybody can guide me, it will be great.

Thanks,
Chinmay.
 
SL Narasimhan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just include appserv-rt.jar in your classpath while running the code( I tried it on 1.4) and it works fine. This is because SerialContextInitFactory class is present inside appserv-rt.jar. You can find the file in SUN_INSTL/appserver/domains/domain1/lib

Cheers,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic