• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dependency of Web modules and EJB modules

 
Nicholas Cheung
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.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB can EJB so I guess C is correct.
 
Vijay S. Rathore
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.
 
Michael Zalewski
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.
 
Howard Kushner
author
Ranch Hand
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic