Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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();
}


}
}
 
He baked a muffin that stole my car! And this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic