Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

errorrjavax.naming.NameNotFoundException No object bound for java:comp/env/hi/helloBean  RSS feed

anshul bhatt
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
catch (Exception e) {
System.err.println("errorr" +e);

Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!