This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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 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

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

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
Hi !

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