This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes EJB Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "EJB Question" Watch "EJB Question" New topic
Author

EJB Question

amol deshpande
Ranch Hand

Joined: Sep 05, 2003
Posts: 162
Hi, I came accross this question, I got it wrong.

The Enterprise JavaBean 2.0 specification has introduced the notion of local Clients. What are Local Clients and why were they introduced?
A) Local Clients should be used when the web server is running on the same machine as the application server.
B) Local Clients should be used when Session Beans need to communicate with Entity Beans. Beans in the same Virtual Machine should use local Clients.
C) Local Clients have been introduced to make testing code easier.
D) Local Clients have been introduced to improve maintainability.
E) Local Clients should be used when the database is running on the same machine as the application server.


I answered A, B
But according to exam(mock), its C and E

Im Lost!!!
Amol
Vagner Freitas
Ranch Hand

Joined: Aug 02, 2004
Posts: 85
Hi Amol,

I am not sure, but I think this:
A) *same machine* does not mean *same JVM*, then I do not think this answer is correct.
B) *SB need to communicate with EB*, but we could use local client between two SB, or between the client and SB. Then this answer is incorrect.

In my opnion, neither C, D and E are correct. I am lost too.
But, I think the exam is about EJB 1.1 and this kind of question does not occur.

Vagner


SCJA, SCJP, SCBCD & SCEA (Part I)
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
I think its time you found a more reliable source for your practice questions.

I agree with (B) however I'd quibble with (A).

The EJB 2.0 Spec states in "5.3 Local Clients"

Unlike the remote client view, the local client view of a bean is not location independent. Access to an enterprise bean through the local client view requires the collocation in the same JVM of both the local client and the enterprise bean that provides the local client view. The local client view therefore does not provide the location transparency provided by the remote client view.


Now the answer states: "A) Local Clients should be used when the web server is running on the same machine as the application server."
If the web server and the application server are separate applications they will most likely run in separate processes - how are they going to share a JVM?.
I simply don't know if the current generation of application servers run the web container in the same JVM as the EJB container - for the EJB container callbacks to work the web container would actually have to run inside the EJB container. Can servlets use local EJB interfaces? I don't think so (I'm probably wrong, but where exactly in the J2EE specs is this guarantueed? - wait a minute the servlet spec does mention the <ejb-local-ref> element - so I was wrong) - though I wouldn't be surprised if there are some proprietary vendor extensions that would allow (remote) call optimization between a collocated servlet and EJB.

PS: Actually looking at (B) again - even that one is shaky
  • "Beans in the same Virtual Machine should use local Clients." TRUE.
  • "Local Clients should be used when Session Beans need to communicate with Entity Beans." Yes - if the Session bean is collocated with the entity bean. Otherwise you have to use a remote interface. So really this part is FALSE as it does not specify that the beans are collocated. Its anybody's guess if the second sentence is supposed to imply this.


  • [ September 22, 2005: Message edited by: Peer Reynders ]
    amol deshpande
    Ranch Hand

    Joined: Sep 05, 2003
    Posts: 162
    Hello Vagner,
    First of all, thanks for taking time and considering questions.

    I've some comments.

    a) Local Clients should be used when the web server is running on the same machine as the application server

    --- Thats the pretty common use of Local clients I guess.I've used it so many times and I cant imagine same machine and different JVM's although thats possible.

    b) Local Clients should be used when Session Beans need to communicate with Entity Beans. Beans in the same Virtual Machine should use local Clients.

    ---- If JVM is the problem with (a), then here it cant be. So I cant find a reason to deselect this one. In fact, this is a very very strong reason why sun introduced Local clients!!!

    C) Local Clients have been introduced to make testing code easier.
    ..........Just gotta convince me how!!! Its there to reduce remote call cost and not testing.

    D) Local Clients have been introduced to improve maintainability.

    ------ Local Clients cant help us change part of code without regression!!! (Maintainability def)

    E) Local Clients should be used when the database is running on the same machine as the application server
    --------this is impossible !!! DB server is not what Local Clients/Interfaces talk to.....its Bean they have to talk to.

    So, do you think explainations are kinda ok?

    Amol
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: EJB Question
     
    Similar Threads
    To Nikhil Pendharkar for IBM 287
    local mode need clarification
    incorrect answer in mock test
    Passed 700,701 and 340 last Thursday
    287 Pre-assessment test questions - Please answer