This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes EJB Beginner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Beginner" Watch "EJB Beginner" New topic

EJB Beginner

Gobind Singh
Ranch Hand

Joined: Aug 04, 2006
Posts: 62
Question on EJBs:

If someone as deployed an EJB on a server, and I am trying to invoke one of its methods, what do I need to do this?

I have seen some examples of client code that do the following:

1.get InitalContext
2.using InitialContext get a reference to the home
3.Use the narrow() method to cast it down to the type you want.
4.Call the create() method on the home object to get a reference to the Remote inteface
5.Call the required methods on the remote interface.

Question: In step 3 where we cast it to the type that we want. Does this mean that I must have the Home class and the Remote class available to me?
Is this usually the case when a third party provides a EJB already deployed, do they give you the home and remote interfaces so that you can cast down to them?
Inesh Hettiarachchi

Joined: Feb 07, 2004
Posts: 25
you must have the stub generated by the deployment tool to cast the object
and providers give only the stub of the bean deployed .
Cheers .
It is sorta covered in the JavaRanch Style Guide.
subject: EJB Beginner
Similar Threads
how to call an EJB from another EJB(both are in different jar files)
can client able to call EJB directly
Just took the IBM J2EE (483) Exam....
choosing between home business methods and finders
HFEJB: ejb deployable jar content ?