Skip navigation.
Home

ejb exception

walid_s232000's picture

after greeting ,

this exception is appeared when i run the ejb bean client class

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: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 com.cgc.guarantee.entity.GuaranteeEJBClient1.main(GuaranteeEJBClient1.java:17)

waiting yours replied

thanks for all

Mmm, to intialize the EJB

Mmm, to intialize the EJB context; you should provide some properties to your application about the EJB container. I think you should initialize your context like that

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "admin");
env.put(Context.PROVIDER_URL,"jnp://192.168.1.200:1099");
Context context = new InitialContext(env);

I hope this can solve the problem