Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Carolina Lopez   on Nov 20 In Java Category.

  
Question Answered By: Allan Bailey   on Nov 20

I tried to use the "Sun Java Studio Entrprise" to write my first ejb,
but I found this Exception

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:645)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:2\
84)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at mainApp.main(mainApp.java:42)


in That block of code:

Hashtable hp = new Hashtable();

hp.put("java.naming.factory.Initial","com.sun.jndi.cosnaming.CNCtxFactor\
y");
hp.put("java.naming.provider.url","iiop://localhost:3700");
Context context  = new InitialContext(hp);
Object ob = context.lookup("ejb/GoodsBean");

Could any one help me wz that error?

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on NoInitialContextException Or get search suggestion and latest updates.