• Post Reply Bookmark Topic Watch Topic
  • New Topic

client code

 
alec stewart stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is wrong with the folowing code n runtime it gives the error:-
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContex
tFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFact
ory]
package hello;
import java.rmi.*;
import java.rmi.server.*;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
public class Sai{
public static void main(String ss[])
{
try{
Properties prop = new Properties();
System.out.println("11111");
prop.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
System.out.println("2222");
prop.put(Context.PROVIDER_URL,"t3://localhost:7001");
System.out.println("3333");
Context ctx = new InitialContext(prop);
System.out.println("4444");
Object objref = ctx.lookup("SimpleMessenger");
System.out.println("5555");
SimpleMessengerHome home = (SimpleMessengerHome)javax.rmi.PortableRemoteObject.narrow(objref,SimpleMessengerHome.class);
System.out.println("66666");
SimpleMessenger inter = home.create();
System.out.println("");
System.out.println("ejb value ********* "+inter.retrieveMessage());
}catch(Exception e){System.out.println(" "+e);}
}
}
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alec
The Root exception you get is,
Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]
Which means in your "client classpath" JVM is not able to find the weblogic.jndi.WLInitialContextFactory class.
We have to make sure that client is "also" J2EE enabled and by that I mean it must have necessary jar files that are needed to make JNDI connections etc...
Regards
Maulin
 
alec stewart stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that it is unable to find Initial context factory.
i am using weblogic 8.1.
can you tell me which initial context factory should i use in case of weblogic 8.1
prop.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
:roll:
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have not worked with Weblogic so I am not sure of the factory we are looking for..
If you post it on weblogic forum you might get an answer...
Regards
Maulin
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!