[Last Call] Learn how to a build a cloud-first strategyRegister Now


Making a remote ejb call

Posted on 2004-11-06
Medium Priority
Last Modified: 2013-11-24
Can someone tell me how to make a remote ejb call?

I have two ear that are supposed to be deployed on WAS.  I want to make a remote ejb call from on to the other.
Question by:bhojwanc1
  • 2

Author Comment

ID: 12513522
remote ejb call
LVL 13

Accepted Solution

petmagdy earned 2000 total points
ID: 12513655
if u r calling ur EJB from Web Module for example, and the EJB Bean is called Account example which have a JNDI name called for example myproject/mymodule/Account:
in ur /WEB-INF/web.xml define resource reference like this:
      <ejb-ref id="EjbRef_1">

Second: in ur /WEB-INF/ibm-web-bnd.xmi define resource reference--JNDI map like this:

  <ejbRefBindings xmi:id="EjbRefBinding_1" jndiName="myproject/mymodule/Account">
    <bindingEjbRef href="WEB-INF/web.xml#EjbRef_1"/>

in ur Code:

        Context initCtx = new InitialContext();
        Object o = initCtx.lookup("java:comp/env/ejb/Accunt");
        AccountHome home = (AccountHome) javax.rmi.PortableRemoteObject.narrow(o, AccountHome.class);
        Account account = home.create();
         // now call ur methods
LVL 13

Expert Comment

ID: 12513667
and one more thing u need the remote and home of the called EJB in ur EAR

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
A solution for Fortify Path Manipulation.
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month18 days, 4 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question