• Post Reply Bookmark Topic Watch Topic
  • New Topic

JNDI - "NoInitialContextException "

 
pola
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i have weblogic 7.0 installed on the system and i am trying to run a simple JNDI application. I am getting the follwing exception (compiling without any errors!).
------------------------------------
D:\J2EE\Jndi>java WebLogicContextClient
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.
WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: web
logic.jndi.WLInitialContextFactory]
------------------------------------
Here is the code snippet:
-----------------------------------------------------------------
try {
Context ctx = null;
Properties props = new java.util.Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
props.put(Context.PROVIDER_URL, "t3://localhost:7001");
ctx = new InitialContext(props);
---------------------------------------------------------------------------
Please help me to resolve this..
Pola
 
Alka S.
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Copy weblogic.jar in the classpath.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pola,
As your display name currently doesn't comply with our naming policy, I'll have to ask you to update it accordingly (a last name is required).
Thanks.
 
pola
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alka,
I have set the classpath to it and its not throwing NoInitialContextException. But i am getting the following exception when i run the code.
----------------------------------------------------
D:\J2EE\Jndi>java Customer
javax.naming.CommunicationException [Root exception is weblogic.socket.Unrecover
ableConnectException: [JDK 1.3 or higher required]]
----------------------------------------------------
I have already set the classpath to C:\jdk1.3 which is my Java Home directory. Any help is grtly appreciated.
Pola
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!