Re: About Java RMI



418928@xxxxxxxxxxxxxxx wrote:

1) Why must a constructor of a remote object throw RemoteException? I
understand that this is because the constructor executes some code
related to RMI initialization (because it extends an RMI class). What I
don't see is why this exception is called RemoteException: as opposed
to what happens with remote methods, this exception in the constructor
is never thrown remotely (because the constructor is always called
locally by the server application).

True. That's just the way it is. Actually it tends to throw ExportException which as defined extends RemoteException.

2) I think it should be possible for a client to download a remote
stub. This should be done by defining an appropriate remote class
server. However, I'm not sure about how useful this would be. I can
only think of using this to allow the client to perform dynamic
invocations.

It is indeed possible. See the codebase feature. It's very useful in situations where you don't have great control over the client deployments, e.g. the Web, or large corporate deployments.

3) One of the reasons I've heard in favour of RMI against other
technologies like CORBA is that it uses HTTP to implement the name
service, so there is no problem with the use of firewalls (they say).

This is untrue, but see below.

However, what about the remote invocations? These would use TCP and a
client could open a socket on any port at the local machine to connect
to a remote object... Am I right? Isn't some kind of HTTP tunneling
required? How can this be done? If you have any nice reference, please
let me know.

RMI can use HTTP tunnelling for both the naming lookup and for general RMI calls. As the naming lookup is a general RMI call too, this is no surprise. See the RMI Specification for details.

There are firewall problems with practically any Web technology post Telnet, FTP, and HTTP, and CORBA and RMI are not exempt.
.



Relevant Pages

  • Re: File copy through RMI
    ... > I need to perform a remote file copy on large files. ... > Since I cannot pass back the input stream through RMI, ... > I am reading the input stream, creating an array of bytes, ... it is time consuming to read 15 MB from ...
    (comp.lang.java.programmer)
  • RMI goes deep
    ... Java-based system into RMI platform. ... There is a kind of remote event mechanism that allows server ... So in order to work with RMI, I should rewrite those client classes to ...
    (comp.lang.java.programmer)
  • Re: Multiple threads with RMI
    ... you will only see that if you have programmed your server that way ... remote method invocation on the same remote object may execute ... a remote object implementation needs to make sure its ... is there some sort of newsgroup for RMI support? ...
    (comp.lang.java.programmer)
  • Re: RMI reliability in RPC-like use cases
    ... RMI implements 'at-most-once' semantics. ... sending the result from the server, or receiving it at the client. ... If I invoke a remote method (a method on a ...
    (comp.lang.java.programmer)