Hi,
I am trying to call local EJB2.1 stateless session bean via
java main class but getting this error. I am using netbeans6.5 with glassfish v2, however am able to successfully call EJB2.1 remote session bean. the java client code is as follows:
import hi.helloLocal;
import hi.helloLocalHome;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
/**
*
* @author anshul
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(
String[] args) {
String s="-"; // Just declare a string
try {
Context context = new InitialContext();
helloLocalHome myhelloHomeLocal = (helloLocalHome)context.lookup("java:comp/env/hi/helloBean");
helloLocal myhelloLocal = myhelloHomeLocal.create();
// So, just go ahead and call a method (in this case the only method).
s = myhelloLocal.hello();
System.out.println(s);
}
catch (Exception e) {
System.err.println("errorr" +e);
s=e.toString();
}
}
}