Friends
While i tried to create session bean i got the following error:
java.lang.NoClassDefFoundError: javax.naming.InitialContext
How to correct it?
Thanks
************************************************************
The line which cause the above error:
initContext = new javax.naming.InitialContext(properties);
************************************************************
The code:
public HelloWorld create() {
HelloWorldHome helloHome = null;
javax.naming.InitialContext initContext = null;
// Get the initial context
try {
System.out.println("Retrieving initial context...");
java.util.Hashtable properties = new java.util.Hashtable(2);
// local name server
properties.put(javax.naming.Context.PROVIDER_URL, "iiop:///");
// IBM name services
properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.jndi.CosNaming.CNInitialContextFactory");
initContext = new javax.naming.InitialContext(properties);
}
catch (javax.naming.NamingException e) {
System.out.println("Error retrieving the initial context: " +
e.getMessage());
System.exit(0);
} // endtry
// lookup the home interface using the JNDI name
try {
System.out.println("Retrieving the home interface...");
java.lang.Object o = initContext.lookup("HelloWorld"); // this is the
JNDI
name
if (o instanceof org.omg.CORBA.Object)
helloHome = HelloWorldHomeHelper.narrow((org.omg.CORBA.Object)
o);
}
catch (javax.naming.NamingException e) {
System.out.println("Error retrieving the home interface: " +
e.getMessage());
System.exit(0);
} // endtry
// Create a new HelloWorld to return
System.out.println("Creating new HelloWorld...");
HelloWorld hello = null;
try {
hello = helloHome.create();
System.out.println("HelloWorld created!");
}
catch (Exception e) {
System.out.println("Exception creating new helloWorld: " +
e.getMessage());
System.exit(0);
} // endtry
return hello;
}
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".