File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Client does not run Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Client does not run" Watch "Client does not run" New topic

Client does not run

Loukas G

Joined: Mar 04, 2004
Posts: 7
Hi, I am new at EJB and i read Head First EJB.I use Windows XP,J2EE Reference Implementation and J2SDK 1.4.2.When i tried to run the first example and specifically the client (AdviceClient) the following message was displayed:
E:\source\projects\advice>java AdviceClient
Context Created!!!
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(
at javax.naming.InitialContext.getDefaultInitCtx(
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
at javax.naming.InitialContext.lookup(
at AdviceClient.go(
at AdviceClient.main(

import javax.naming.*;
import java.rmi.*;
import javax.rmi.*;
import headfirst.*;
import javax.ejb.*;

public class AdviceClient
public static void main(String[] args)
new AdviceClient().go();
public void go() {
Context ic = new InitialContext();
System.out.println("Context Created!!!");
Object o = ic.lookup("Advisor");
System.out.println("Lookup DONE!!!");
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o, AdviceHome.class);
System.out.println("Narrowing DONE!!!");
Advice advisor = home.create();
System.out.println("Remote Object Created!!!");
catch (Exception ex)

Now from the message i think that somewhere i must specify the properties of InitialContext.Am i right and if i am where and how can i do this? Kathy,Bert HELP please!
I agree. Here's the link:
subject: Client does not run
jQuery in Action, 3rd edition