Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

EJB & RMI CallBack

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

I am wondering how call back happens in EJB.
I created an interface called CallBack.This extends Remote.
This contains a method update(String msg).

CallBack extends Remote {
void update(String msg) throws RemoteException;
}

Then to my ejb i pass this interface as shown below.
public void register(CallBack callback) {
try {
if(callback!=null) {
callback.update("Msg from Server");
}
}catch(RemoteException e){
e.printStackTrace();
}
}
I created a client which implements the CallBack interface and i called
the ejb's register method.Surprisingly i got a message from the server.
How does this work. Normally in RMI for the call back to work the client
should also expose itself as a RMI Server.This is usually done by
UnicastRemoteObject.exportObject(client);After this you use rmic to generate the stub and skeleton classes. For the EJB case i didnt export the client with exportObject nor i generated any stub and skeleton. How was the ejb able to call back the client in this scenario.Sorry for the long mail

Thanks
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I presume that its the 'RMIC' task's output. When an object is passed as a Parameter to EJB method, it must be either of serializable(externalizable) or Remote type.
If serializable, the picture is clear, the RMIC generates the stub for EJB methods for client's access.
If its Remote, then RMIC is taking the next step of generating the stub for this callback Remote object and give the stubs to EJB method.
When you do the RMIC, probably you can make the callback as serializable once and Remote once, then do RMIC and compare the generated stubs.
 
Prem Kumar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the issue.It was done by some classes in weblogic.jar.If you give
this jar to the classpath ,it automatically generates a stub for the remote object.So thats how the callback worked.it was using the stub generated by some classes in weblogic.jar.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prem,

Did you find out that this ejb->client callback is a documented feature in Weblogic? I cant find this documentation in edocs..??

thanks
tyago
 
This tiny ad will self destruct in five seconds.
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