• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

AdviceClient from HeadFirst EJB is not Running

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying the example given in the book. I've set all the environment variables according to given on wickedlysmart.com. I'm able to deploy the bean with the help of deployment tool given with the sun development kit. But as I'm trying to run the client program "AdviceClient" it is throwing an exception like this:

C:\Users\Shashi\sonu\projects\advice>java -cp AdviceAppClient.jar;C:\Sun\AppServ
er\lib\j2ee.jar;. AdviceClient
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(NamingManager.java:6
45)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247
)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
a:284)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at AdviceClient.go(AdviceClient.java:15)
at AdviceClient.main(AdviceClient.java:9)


please suggest me what to do? Respond me as soon as possible I'm waiting for your answer
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shashi,

Welcome to JavaRanch


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



This exception is thrown if there is no jndi.properties in the classpath of the client (and you don't pass the context related properties to the InitialContext). Each application server has its own values for the context related properties which are specified in the jndi.properties file. For Sun App server, i vaguely remember that the appserv-rt.jar contains the appropriate jndi.properties file. So including the appserv-rt.jar file in the client's classpath should solve this issue.
 
Just let me do the talking. Ahem ... so ... you see ... we have this tiny ad...
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic