• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

getting error from AdviceClient code from Head First EJB book, pg 57

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to compile and then run the code for AdviceClient.java from page 57, and I'm getting the following error when I goto run the code.
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(NamingManager.java:640)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at AdviceClient.go(AdviceClient.java:19)
at AdviceClient.main(AdviceClient.java:10)
I'm using the following two lines to compile and then run it.
D:\Ejbs\advice>javac -classpath .\classes;d:\j2sdkee1.3.1\lib\j2ee.jar AdviceClient.java
D:\Ejbs\advice>java AdviceClient
What is going on here?
 
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Martin Brice:
I'm trying to compile and then run the code for AdviceClient.java from page 57, and I'm getting the following error when I goto run the code.
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(NamingManager.java:640)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at AdviceClient.go(AdviceClient.java:19)
at AdviceClient.main(AdviceClient.java:10)
I'm using the following two lines to compile and then run it.
D:\Ejbs\advice>javac -classpath .\classes;d:\j2sdkee1.3.1\lib\j2ee.jar AdviceClient.java
D:\Ejbs\advice>java AdviceClient
What is going on here?


Make sure that environment variables are correctly configured.
http://www.wickedlysmart.com/HeadFirst/HeadFirstEJB/HeadFirstEJBNotes.html
Include j2ee.jar in classpath,use the following command to compile
javac -classpath %CLASSPATH%;AdviceAppClient.jar AdviceClient.java
Use following command to run
java -cp %CLASSPATH%;AdviceAppClient.jar AdviceClient
Veena
 
Martin Brice
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm just about to try this out tonight. Thank you for the reply.
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi !

I'm having the same problem. Anyone have an idea ?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic