Re: Stub File
Peter Jones - JavaSoft East <[email protected]>
| Newsgroups | gmane.comp.java.sun.rmi |
|---|---|
| Message-ID | <20050126052648.GC3925@east> |
> In the API Documentation from RMI Tiger says that I don't need
> pregenerated the stub file from the Remote Object class, but in my
> application when i run the server(that is the remote object) the JVM
> request the _stub file.
>
> What will be?
>
> Bellow the source code:
[snip]
> Servidor stub = (Servidor) UnicastRemoteObject.exportObject(this);
Unfortunately, a pregenerated stub class is still required when you
use that particular exportObject method, because its return type is
java.rmi.server.RemoteStub (a class, which cannot be extended by a
dynamic proxy class); changing that return type would have broken
binary compatibility. See this footnote in the release notes[*]:
http://java.sun.com/j2se/1.5.0/docs/guide/rmi/relnotes.html#callout
Instead, use the UnicastRemoteObject.exportObject method that also has
a port parameter; its return type is java.rmi.Remote, an interface, so
a dynamic proxy instance can be returned (and is, if a pregenerated
stub class is not available). Use zero for an anonymous port:
Servidor stub = (Servidor) UnicastRemoteObject.exportObject(this, 0);
-- Peter
[*] or the documentation for the UnicastRemoteObject class:
http://java.sun.com/j2se/1.5.0/docs/api/java/rmi/server/UnicastRemoteObject.html
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS". For general help, send email to
[email protected] and include in the body of the message "help".
For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html
To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html