An EJB client is any object that contacts an EJB. For this contact to work, EJBs need to know how to find each other. In most EJB applications, completing business logic in one EJB involves invoking another EJB. In this case invoking bean is a client.

To invoke a method from another EJB in the same container, from the client EJB, add a method for looking up the home object of the needed EJB like in the example below. With a reference to the home object, you can invoke any methods declared by the interface.

private SomeBeanHome getSomeBean() {
  try {
    // creates a default InitialContext instance:
    Context ic = new InitialContext();
    // performs JNDI lookup of the EJB home-object:
    SomeBean passwordHome = (SomeBeanic.lookup("test.someHome");
    return passwordHome;
  catch (NamingException error) {
    return null;