• Post Reply Bookmark Topic Watch Topic
  • New Topic

How we get the Ejb home and ejb remote implementaion at clent side?  RSS feed

 
scott miles
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In some articles on different sites i read that we only serialize/deserialize the state of object.On the deserialization side actual class definition should be present.

If that is the case, In case of EJB then how we get the Ejb home and ejb remote implementaion from server(which is on remote machine) as on client side we just have home and remote interfaces on client side?
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Remote interface is a step up from Serializable. With Remote objects, you can actually retrieve both object state and interface definition out of a directory (as you do with EJB homes) or by return values from other Remote objects (as with EJB remote).

All you get is the interface definition though, not the implementation. When you call a method on a remote object, what really happens is that you call a stub implementation on the client side, which implements your interface. The stub method marshals the parameters ... that is it prepares them to be sent across the network ... and then sends a message to the server. On the server side, a skeleton implementation receives the message, parses it, and makes the call on the real object. For return values the same process happens in reverse.

If you want a deeper understanding of how EJBs work, I suggest running through a tutorial on RMI. EJBs abstract some of the details away from, but you get to see it all with RMI.
 
scott miles
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Greg, let me explain my question further and let me know if i got your expanation correct or not.

Below is code at client side

MyEJBHome home1= context.lookup("home1");

//Here at client side we just have MyEJBHome interface. No implemetation(even not stub). We get the implemantation at runtime on lookup from server side. Right?

MyEJBRemote remote1=home1.create();

//here also we just have MyEJBRemote interface. No implementation of MyEJBRemote exist at client side . On calling create method on home we get the stub implementation from server side at run time .Right?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!