Re: [RMI] Questions about RMI and Tomcat/Apache

Gregg Wonderly <[email protected]> Tue, 19 Dec 2006 08:54:43 -0600
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
Vanfleet, David wrote:
> What I need is to be able to send and receive Java objects from the
> client (application and applet) to the server. If possible my RMI server
> needs to be setup so this data is passed by way of the HTTP protocol on
> port 80. I need this because of the way the server is setup on the
> network (the server is in the internal network and traffic is routed to
> it, through the firewall, by way of a HTTP reverse proxy from a separate
> system in the DMZ).

There are several different issues here.  First, is Java Object transport
between systems.  This is what Serialization and Remoting facilities such as the
old RMI in the JDK and the new RMI in the Jini platform help support.

To send an Object with well known classes in it, to another JVM, you can use
simple ObjectInputStream/ObjectOutputStream stuff on a socket.  If, there is
additional need to send unknown classes (interface implementations and support
classes), then you need to set the java.rmi.server.codebase system property to
one or more (space separated) base URLs/Jar URLs, and use MarshalledObject to
wrap the object on the "server" before sending it to the client.  The client
will then perform MarshalledObject.get() to reconstitute the object by
downloading any appropriate code bits.

RMI and Jini provide lots of infrastructure around this via there "lookup"
mechanisms to 'hide" the MarshalledObject(s) from you so that you just get back
live objects that you can use.

In your case, you need to send objects back to clients through a web server
based URL.  The servlet can respond to the incomming request by setting an
appropriately recoginized (by the client) mime-type, and then writing back a
MarshalledObject.

If you are willing to learn about Jini, the bantam.dev.java.net project has
tools for making Jini work through firewalls.  It lets you deploy a WAR for your
service, and then provides access through the web server.

This is not hard stuff, just lots of detail to learn, understand and configure.

Gregg Wonderly

===========================================================================
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