• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJBObject Stub Reference (vs) Client  RSS feed

 
Sridevi Sangaiah
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.
 
Vishwa Kumba
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.
 
Kathy Sierra
Cowgirl and Author
Rancher
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!