I am just writing a simple session bean. I have successfuly deployed the bean
the directory structure is C:\asheesh\classes\com\bizwise\ejb. under This I have kept all my java files including client
my client code is
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import java.util.Properties;
import com.bizwise.ejb.*;
//import com.bizwise.ejb.Adder;
//import com.bizwise.ejb.AdderHome;
public class BeanClient {
public static void main(String[] args) {
// preparing properties for constructing an InitialContext object
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.PROVIDER_URL, "localhost:1099");
try {
// Get an initial context
InitialContext jndiContext = new InitialContext(properties);
System.out.println("Got context");
// Get a reference to the Bean
Object ref = jndiContext.lookup("Adder");
System.out.println("Got reference");
// Get a reference from this to the Bean's Home interface
AdderHome home = (AdderHome)
PortableRemoteObject.narrow (ref, AdderHome.class);
// Create an Adder object from the Home interface
Adder adder = home.create();
System.out.println ("2 + 5 = " + adder.add(2, 5));
}
catch(Exception e) {
System.out.println(e.toString());
}
}
}
Please help me I m getting the below error
C:\asheesh\classes>java com/bizwise/ejb/BeanClient
Exception in thread "main" java.lang.NoClassDefFoundError: com/bizwise/ejb/BeanC
lient (wrong name: BeanClient)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Please help me