This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

EJBObject Stub Reference (vs) Client

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
When we say that the EJB client gets a reference to an EJBObject, it is actually the reference to the EJBObject stub implemented by the container. In java inorder to use a reference it is necessary that the user should be aware of the class of the reference. Hence EJBClient should be aware of the EJBObject stub class.
How will the client get the class file of EJBObject stub ?
Regards
Sridevi.
 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually the deployment tools have an option to generate the client stub classes, which are used by the EJB clients.
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right, for a Remote interface (either home or component) the client will have a reference to a proxy of the EJBObject (or EJBHome) and *not* a reference to the actual object. The client *does* need that class file, but how this happens depends entirely upon your application server (and the environment in which the client is running).
So at compile time, the client needs the interfaces, but at runtime the client needs the interfaces AND the stub classes, but HOW the client gets the classes will vary...
The most straightforward, and perhaps most common way is when the deployment tools generate stub classes, and package them into a "client jar". The client puts this in his classpath, and everything is cool. This client jar may also include the home and component interfaces. Some server/client scenarios can dynamically send the proxy class to the client, in such a way that the client doesn't need to have the stub class physically present prior to runtime.
Remember, the client code is not usually portable, even if the bean is (although that's a good reason to build your client using, say, the ServiceLocator pattern or something like it). You'll have to find out from your app server exactly what the client must know and have in order to run correctly.
cheers,
Kathy
 
Sridevi Sangaiah
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kathy i got what i wanted from your reply. So passing the stub classes to the client is the responsibility of the application server developer.Am I right?
regards
Sridevi
 
You would be much easier to understand if you took that bucket off of your head. And that goes for the tiny ad too!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic