• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Bear Bibeault
  • paul wheaton
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Mikalai Zaikin
  • Piet Souris
Bartenders:

EJB Question

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
    Posts: 162
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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 have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad:
    Low Tech Laboratory
    https://www.kickstarter.com/projects/paulwheaton/low-tech-0
    reply
      Bookmark Topic Watch Topic
    • New Topic