I created simple EJB session bean, and created EJB client to session
bean, and I got the following error. However, when I run in
EJB test client (JNDI explorer) inside WSAD then everything is fine.

com/ibm/WsnOptimizedNaming/NamingContextOperations is the IBM class and
maybe I should include the external JAR in the build path, but I don't
know which JAR is the one. How do i find out?


java.lang.NoClassDefFoundError:
com/ibm/WsnOptimizedNaming/NamingContextOperations
at
com.ibm.websphere.naming.WsnInitialContextFactory. getInitialContext(WsnInit*ialContextFactory.java:1 04)

at
javax.naming.spi.NamingManager.getInitialContext(N amingManager.java:674)

at
javax.naming.InitialContext.getDefaultInitCtx(Init ialContext.java:255)
at javax.naming.InitialContext.init(InitialContext.ja va:231)
at javax.naming.InitialContext.(InitialContext.java:207)
at simple.book.EJBClient.main(EJBClient.java:33)
Exception in thread "main"


This is the session bean client code, please advise!!


package simple.book;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Properties;


public class EJBClient {


public static void main(String[] args) throws Exception {


Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
properties.put (
javax.naming.Context.PROVIDER_URL,
"iiop://localhost:2810");
Context context = new InitialContext (properties);
Object obj = context.lookup("SimpleCounterEJBHome");
SimpleCounterEJBHome home = (SimpleCounterEJBHome)
javax.rmi.PortableRemoteObject.narrow(
obj, SimpleCounterEJBHome.class);
SimpleCounterEJB hello = home.create();
System.out.println(hello.showMessage("Hello World
EJB"));
}