Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoInitialContextException

 
AmitCdac Grover
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi..

i am new to ejb. when i try to run the client.which is calling the bean it gives me the following exception.there is no any error in compilation

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(UnknownSource)
at javax.naming.InitialContext.lookup(Unknown Source)
at AdviceClient.go(AdviceClient.java:21)
at AdviceClient.main(AdviceClient.java:13)


this is the same error which i got after deploy on weblogic 7.0 and j2ee1.3
i put my bean and related classes in folder in d:\projects\advice

and my weblogic is installed on d:\bea\weblogic

plz tell me how can i overcome this problem
 
Poobhathy Kannan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This exception usually means the JNDI Server is not running, or possibly the JNDI properties for the server are incorrect.
Read this..
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
For weblogic 8.1 if you are calling for a client that is not on the same server then you need to get the Initial context by providing the server properties. Please see the sample code:

InitialContext context=null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
try {
context= new InitialContext(ht);
}


hope that helps.
 
AmitCdac Grover
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks . by giving this setting in weblogic my program run fine

thanks very much..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic