Could anyone help me out in fixing the above mentioned exception in my AdviceBean application? Please find below the exception details:
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:31)
at AdviceClient.main(AdviceClient.java:18)
I got this exception when i tried to run the client. Pl find below the client code:
try
{
Properties props=System.getProperties();
Context ic= new InitialContext(props);
Object o=ic.lookup("Advisor");
AdviceHome home= (AdviceHome)
PortableRemoteObject.narrow(o, AdviceHome.class);
Advice advisor=home.create();
System.out.println(advisor.getAdvice());
}catch(Exception e)
{
e.printStackTrace();
}
I did try without passing the system properties to InitialContext and I got the same exception. I thought by passing environment properties , it would create initial context factory . But, it didn't help me either.
I have deployed enterprise bean(AdviceBean ) in Sun Application Server 8. Deployment was successful ...but couldnt run the client.
Could anybody help me out on this?
thanks,
andrew