Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Dependency of Web modules and EJB modules

 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Howard,
I saw a sample exam question asking the following:
What are true (Choose 2)?
A. Web modules can be depended on other Web modules.
B. Web modules can be depended on other EJB modules.
C. EJB modules can be depended on other EJB modules.
D. EJB modules can be depended on other Web modules.
I guess it should be B and C. Is that true?
B correct becos JSPs can call EJBs, and then get the results for displaying.
C correct becos in EJB 2.0, local home is used for one EJB module to be called by others.
But why A incorrect? I remember Web modules should be able to locate another Web modules by looking up the container's ServletContext, isnt it?
However, I just make this guess, can anyone explain to me?
Thanks.
Nick.
 
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB can EJB so I guess C is correct.
 
Ranch Hand
Posts: 449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dependency will make them to run always in one JVM, what if you want to run both web modules in deifferent distributed environment?
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vijay,
Oh, yes. I get it. I missed the cases that the modules can be run on different JVMs in the distributed environments.
This Q is really tricky, I think. It does not mention the background.
Anyway, thanks for clearing up my doubts.
Nick.
 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Oh, yes. I get it. I missed the cases that the modules can be run on different JVMs in the distributed environments.


I'm not really satisfied with this explanation. My thinking goes like this:
There is such a thing as an ejb-reference, which you can stick inside a web application or ejb specification. So EJBs can go "inside" of a web application, or another EJB. That makes B and C correct.
But there is no such thing as a web-app-reference. So you can't stick anything into a WAR file to make it depend on another WAR. Nor can you stick anything inside a EJB specification to say that this EJB contains a web app as a component. Therefore, A and D are incorrect.
 
author
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gentlemen,
I get B and C as the correct answers. Being the pragmatist that I am, I test my theory in WebSphere Studio Application Developer.
Regards,
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Howard,
Yes. I also get B and C, and I have just tried this with WSAD 5 mins ago.
Many Thanks.
Nick.
 
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic