I wrote an application client to execute function on EJB, Client Code is this:
"try {
Context ic = new InitialContext(); // entry point in JNDI service
System.out.println("first line executed");
Object o = ic.lookup("AdviceHome"); // lookup for Advice Bean
System.out.println("second line executed");
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o,
AdviceHome.class);
System.out.println("third line executed");
Advice advisor = home.create();
System.out.println("fourth line executed");
System.out.println( advisor.getAdvice() );
}"
It compiles well but when I tried to execute, it issues following error on 3rd
line :
"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(NamingManager.java:6
40)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
a:280)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at AdviceClient.go(AdviceClient.java:25)
at AdviceClient.main(AdviceClient.java:18)
"