aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes when a servlet calls EJB methods, is it a remote or a local call? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "when a servlet calls EJB methods, is it a remote or a local call?" Watch "when a servlet calls EJB methods, is it a remote or a local call?" New topic
Author

when a servlet calls EJB methods, is it a remote or a local call?

Sat Nar
Ranch Hand

Joined: Oct 22, 2004
Posts: 83
Hi,
I have a basic doubt. If i am developing a servlet and EJB in Weblogic application server, and my servlet calls methods in EJB. Now, is this call a remote call?Is the servlet, a local or remote client?

Thanks in advance.

Regards,
Sathya
aleem khan
Ranch Hand

Joined: Aug 07, 2008
Posts: 94
It is a local as both are in same weblogic server


SCJP(1.4), SCWCD, Oracle 9i SQL certified, Oracle PLSQL Developer Certified Associate
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30929
    
158

Sathya,
It is a local client. You can make either a local or remote call from a local client. You are more likely to be making a local call, but you should check that you are using the local interface.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Sat Nar
Ranch Hand

Joined: Oct 22, 2004
Posts: 83
Thanks lavani & Jeanne for your replies.

Jeanne,
You said that one can make either a local or remote call from a "local client".My doubt is whats the purpose of a remote call from a local client if it can be a local call?Is there not overhead in making a remote call?So use a remote call only if your client is a remote client.This is my understanding.Kindly correct me if iam wrong.

My understanding of a remote call is that if the client and the EJB are present in different Application servers, then it is a remote call. Is my undestanding correct?

In Head First EJB, the author says that if two object present in different heaps, then if one object calls the other, then it is a remote call.
My doubt is what do you mean by "two different heaps"? Is it two different servers or two different JVM's or what is it?

Kindly help me out.

Thanks in advance.
arulk pillai
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3259
My understanding of a remote call is that if the client and the EJB are present in different Application servers, then it is a remote call. Is my undestanding correct?


Yes, you should say two different JVMs (i.e. processes).

In Head First EJB, the author says that if two object present in different heaps, then if one object calls the other, then it is a remote call.
My doubt is what do you mean by "two different heaps"? Is it two different servers or two different JVM's or what is it?


Each JVM (i.e. is a process) has its own heap space. If you make a call from one process (e.g. JVM) to another process, then it is a remote call because the memory address spaces (e.g. heap space) are different. Remote calls require serialization.


500+ Java Interview Questions and Answers | Java job hunting know how & Java resumes
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30929
    
158

Originally posted by Sat Nar:
Jeanne,
You said that one can make either a local or remote call from a "local client".My doubt is whats the purpose of a remote call from a local client if it can be a local call?Is there not overhead in making a remote call?So use a remote call only if your client is a remote client.This is my understanding.Kindly correct me if iam wrong.

You are correct. It's POSSIBLE to make a remote call from the same app. That doesn't make it a good idea. The reason it is possible is that EJB 1 didn't have local interfaces. For backward compatibility and to support old applications that make remote calls, this needs to continue to be supported.


My understanding of a remote call is that if the client and the EJB are present in different Application servers, then it is a remote call. Is my undestanding correct?

Also correct.
Ajay Saxena
Ranch Hand

Joined: Nov 13, 2006
Posts: 154
For application servers that have co-located web and ejb containers,I believe there's only ONE JVM that runs with different threads listening on HTTP and RMI/IIOP ports.Is that correct?
[ August 30, 2008: Message edited by: Ajay Saxena ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: when a servlet calls EJB methods, is it a remote or a local call?