This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

sharp pencil page 107

Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont really understand where I went wrong.. My question is how home class is not required in the Client. Ok. I understand that Client only deals with home class stub. BUT why then it says EJBObject interface is required for both Client and Server? I mean both EJBObject and Home are remote objects and both of them have stubs. Why is that Client side must have EJBObject and not it's stub?
So to summarize: there are Component Interface, Component Interface stub, Home Interface and Home Interface stub. Which ones are required in Client.
THank you!
Cowgirl and Author
Posts: 1589
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy -- this is kind of a confusing exercise, because not all pieces are shown in the picture. On the instructions on page 107, it says, "Note: not all the pieces are here, so when you're done, if you can think of other things that should into the picture (classes or objects) draw them in!"
So you are RIGHT -- the client and server MUST have the EJB object stub class as well as the interface. We just didn't show the EJB object stub class in the diagram (so that you could figure that out
The other thing that we did not show is the Home interface, which also must be on BOTH the client and server.
Those are the things that you should draw into the picture yourself:
* EJBObject stub class (put it on both the client and server)
* Home interface (put it on both the cilent and server)
So... the story is;
Besides the client code, needs the home and component interfaces at both compile and runtime, and the home and component interface 'stub' classes at runtime. The cilent will also need the home and component interface stub OBJECTS at runtime (but that's why the stub classes have to be there, one way or another).
Needs everything that the client needs except the client class, BUT it will also have the implementation classes for the home and component interfaces (i.e. the *things* the stubs can communicate with).
Remember, these diagrams and concepts are about how it *appears* to work. What the Container really does can be different. The most important thing to know is that without the home and component interfaces, the client cannot even compile, and that without the stub classes, the client will fail at runtime.
However, some Containers provide this capability dynamically. So whether YOU as the Bean Provider must hand-deliver the stub classes to the client really depends on your Container. With the J2EE R.I., the client MUST have the stub classes *before* you try to run the client, while other servers can send the classes dynamically using one of several mechanisms (you don't have to know ANYTHING about dynamic proxies or dynamic code downloading for the exam!)
Vladas Razas
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you! Now I understand that there are actual container generated classes behind interfaces (of course the one can not instantiate an interface!). That is Home and EJBObject are not the classes but merely interfaces to classes that container generates. And Home class is the one of those classes.
Those black and white photos are very stylish! I love this book.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic