Originally posted by satish kumar g:
hai Rahul,
After setting the classpath to jndi.jar in jdk folder my client program got compiled.
Now i am getting a run time exception at InitialContext ctx=new InitialContext(var)it is giving the run time error while creating the InitialContext
My Client Program is like this
import java.io.*;
import java.util.*;
import javax.naming.*;
import sat.*;
public class MyHelloClient{
public static void main(String[] args){
try{
InitialContext ctx = null;
Properties env = System.getProperties();
env.put(Context.PROVIDER_URL, "iiop://localhost:900");
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
System.out.println("upto here");
ctx = new InitialContext(env);
System.out.println("upto here1");
Object homeObject = ctx.lookup("MyHello");
System.out.println("upto here2");
MyHelloHome incHome=(MyHelloHome)PortableRemoteObject.narrow(homeObject,MyHelloHome.class);
MyHello incHello=incHome.create();
String s=incHello.sayHello();
System.out.println(s);
}catch ( Exception e )
{
System.out.println(e);
}
}
}
it is printing "upto here" at the console but "upto here1" is not coming it means that the error is while creating the InitialContext.or Is there anything wrong in my client program.
This is the Error I got
upto here
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/rmi/iiop/ORB
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Compiled Code)
at java.security.SecureClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.access$1(Compiled Code)
at java.net.URLClassLoader$1.run(Compiled Code)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at sun.misc.Launcher$AppClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:199)
at org.omg.CORBA.ORB.create_impl(ORB.java:303)
at org.omg.CORBA.ORB.init(ORB.java:352)
at com.ibm.CORBA.iiop.GlobalORBFactory.init(GlobalORBFactory.java:42)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:196)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(Compiled Code)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:65)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:47)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:343)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.initORB(CNInitialContextF
actory.java:355)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.getInitialContext(CNIniti
alContextFactory.java:196)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
71)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242
)
at javax.naming.InitialContext.init(InitialContext.java:218)
at javax.naming.InitialContext.<init>(InitialContext.java:194)
at MyHelloClient.main(MyHelloClient.java:18)
So what i need to do then.
kindly help me as i strucked at this point.
satish