JDK-6505651 : Warn that exportObject(Remote) does not support auto-generating stubs
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.rmi
  • Affected Version: 6
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-12-18
  • Updated: 2013-10-25
  • Resolved: 2013-10-25
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE PROBLEM :
The RMI documentations says that since Java5 RMI no longer requires manual stub generation but it does not make it explicitly clear that this isn't always the case (you must use the correct method).

The Javadoc for exportObject(Remote) should clarify that it does not auto-generate stub files and if the user would like autogenerated stubs he should use exportObject(Remote, int) instead.


URL OF FAULTY DOCUMENTATION :
http://java.sun.com/javase/6/docs/api/java/rmi/server/UnicastRemoteObject.html#exportObject(java.rmi.Remote)

Comments
This has been superseded by JDK-8023863, which deprecates static stubs. The doc updates for that bug clarify a bunch of things, including deprecation of the UnicastRemoteObject.exportObject(Remote) API.
25-10-2013

EVALUATION The unfortunate fact that the UnicastRemoteObject.exportObject(Remote) method still requires a pre-generated stub class is documented up in the main class doc for java.rmi.server.UnicastRemoteObject: http://java.sun.com/javase/6/docs/api/java/rmi/server/UnicastRemoteObject.html as well as in the RMI release note item for the feature of supporting dynamic proxy stub classes: http://java.sun.com/j2se/1.5.0/docs/guide/rmi/relnotes.html but it still has been enough of a source of confusion, for example: http://archives.java.sun.com/cgi-bin/wa?A2=ind0501&L=rmi-users&P=556 that it would indeed seem worthwhile to point it out in the specific method doc as well-- along with a suggestion that merely using the UnicastRemoteObject.exportObject(Remote,int) method, passing zero as the second argument, would be an otherwise equivalent approach that does support dynamic proxy stub classes.
19-01-2007