Home arrow static arrow Java Programming [Archive] - RMI Stub Regeneration
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - RMI Stub Regeneration
This topic has 7 replies on 1 page.

Posts:133
Registered: 11/11/03
RMI Stub Regeneration  
Aug 5, 2004 2:49 AM



 
As I understand it you only need to regenerate a Stub when your remote interface changes. What I don't understand is that, say your remote interface returns an instance of class "User" and you add a new method to this class or change the implementation of one of the methods, what happens at the client end? The client has a copy of the User class that is different than the one on the server. Does this not cause any problems? Do you need to provide the new User class to the client or will everything still work ok? What if you remove a public method of the User class? (a non-binary compatible change)
 

Posts:133
Registered: 11/11/03
Re: RMI Stub Regeneration  
Aug 5, 2004 6:24 AM (reply 1 of 7)



 
Nobody knows this question? I don't believe it! Someone must know the answer!
 

Posts:21,718
Registered: 98-02-20
Re: RMI Stub Regeneration  
Aug 5, 2004 6:31 AM (reply 2 of 7)



 
Either nobody knows, or no one's interested. You can never tell...

Regenerating stubs and skels are one thing, and packaging and deploying your app are another. I'd say that you won't have the problem if changes to applications like the one you're describing mean repackaging and redeploying the app. That's what I'd do. I wouldn't make piecemeal changes like that if I could help it.

But I don't know what would happen, because I've never done it. Sounds like a bad practice to me.

%
 

Posts:319
Registered: 11/8/00
Re: RMI Stub Regeneration  
Aug 5, 2004 6:34 AM (reply 3 of 7)



 
if the remote interface has not changed then there is no need to recompile the stubs. but if the interface specifies a class being returned. then a copy of this class is needed on the client side. Therefore you would need to make sure that your class had a copy of the modified class.

//interface...public User getUser() throws RemoteException;...  //clientUser user remoteObject.getUser();


therefore the user class is needed on both server and client.
You may be better to define the User as an interface then the exact implementation is not all that important and it does not matter if the client has the most uptodate copy of the class.
 

Posts:133
Registered: 11/11/03
Re: RMI Stub Regeneration  
Aug 5, 2004 6:37 AM (reply 4 of 7)



 
I'd say that you won't have the problem if changes to
applications like the one you're describing mean
repackaging and redeploying the app.

The problem is that other (live) applications are using this particular RMI Interface. Redeploying to all of them is a real pain since it involves other third parties. This is why I would rather keep redeployment to a minimum.

Maybe I will make a test to see what happens.
 

Posts:133
Registered: 11/11/03
Re: RMI Stub Regeneration  
Aug 5, 2004 6:40 AM (reply 5 of 7)



 
if the remote interface has not changed then there is
no need to recompile the stubs. but if the interface
specifies a class being returned. then a copy of this
class is needed on the client side. Therefore you
would need to make sure that your class had a copy of
the modified class.

Good, this is what I though. But do you know if I need to supply a copy of the modified class for every change? Is it just for non-binary compatible changes, or do I need to do it if I add a new method or field also? Thank you for your help.
 

Posts:21,718
Registered: 98-02-20
Re: RMI Stub Regeneration  
Aug 5, 2004 6:40 AM (reply 6 of 7)



 
Isn't this problem what Java Web Start was born for?

%
 

Posts:133
Registered: 11/11/03
Re: RMI Stub Regeneration  
Aug 5, 2004 6:44 AM (reply 7 of 7)



 
Isn't this problem what Java Web Start was born for?

%

I don't know if this is an option. The client side RMI classes are in a jar file used by a web application (running on tomcat). If you used web start to keep this jar file up to date, would this work? When would the jar file be updated? I'm guessing you would still have to reboot tomcat?
 
This topic has 7 replies on 1 page.