Uncaught exception (java.lang.NoClassDefFoundError: javax.naming.InitialCon
When I am trying to run the following code in Visual Age for Java.
Properties p = new Properties();
if (this.initialContext == null) {
try {
if (this.portNumber != null) {
String url =
"IIOP://" + this.hostName + ":" + this.portNumber + "/";
System.out.println("Using provider URL of: " + url);
p.put(javax.naming.Context.PROVIDER_URL, url);
}
p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
this.initialContext = new InitialContext(p);
} catch (NamingException e) {
System.out.println("Exception Error-Initial Context");
}
}
This is giving an error as follows at line
this.initialContext = new InitialContext(p);
Could you please explain me how can get rid of this error... I am running the code on local machine in websphere test environment.
ERROR:--
Uncaught exception (java.lang.NoClassDefFoundError: javax.naming.InitialContext)
Client_1.getInitialContext()
this=(TestEJBGroupEJBReserved.Client_1) TestEJBGroupEJBReserved.Client_1@5312
p=(java.util.Properties) {java.naming.factory.initial=com.ibm.ejs.ns.jndi.CNInitialContextFactory, java.naming.provider.url=IIOP://localhost:8080/}
Client_1.main(String [])
args=([Ljava.lang.String;) [Ljava.lang.String;@3ffb
c1=(TestEJBGroupEJBReserved.Client_1) TestEJBGroupEJBReserved.Client_1@5312

