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

HeadFirst EJB - AdviceBean - JNDI Question

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am a newbie to EJB and have just started reading the Headfirst EJB book. I've deployed the AdviceBean but can't access it from the client.

The client - AdviceClient - throws the following runtime error:

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
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:19)
at AdviceClient.main(AdviceClient.java:11)

Here's the AdviceClient.java class source:

public class AdviceClient {
public static void main(String[] args) {
new AdviceClient().go();
}

public void go() {
try {
Context ic = new InitialContext();
System.out.println("All's well so far");

Object o = ic.lookup("Advisor");

AdviceHome home = (AdviceHome)PortableRemoteObject.narrow(o, AdviceHome.class);
Advice advisor = home.create();
System.out.println(advisor.getAdvice());
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}

My enviroment - Sun's Application Server 8.2, J2SE1.5, J2EE 1.4, and Windows XP.

What am I missing?

Thanks in advance,
Sarala
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

My enviroment - Sun's Application Server 8.2, J2SE1.5, J2EE 1.4, and Windows XP. What am I missing?


Just one advice. Head First EJB is aimed at SCBCD 1.3. You should be using J2EE1.3.1 RI and J2SE 1.3 instead.
 
Sarala Rajagopalan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! Couldn't locate the SDK for J2ee 1.3 on Sun and settled for 1.4. Went through the other postings on this board and finally found a link for 1.3 that worked. Shall try with the new setup.

Thanks again,

Sarala
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic