Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AdviceClient from HeadFirst EJB is not Running

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic