Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sun's RMI tutorial trail...

2 views
Skip to first unread message

Tom West

unread,
Dec 17, 2002, 10:54:00 PM12/17/02
to
I just went through Sun's RMI tutorial
(http://java.sun.com/docs/books/tutorial/rmi/).

I understood everything up until the deployment/execution steps
(http://java.sun.com/docs/books/tutorial/rmi/compiling.html).

Since I've never done anything like this before, I believe that I am
misinterpreting the deployment instructions.

They seem to infer that downloading the class files from the server to the
client (and vice versa) requires a web server. This doesn't mean that there
has to be a web server on BOTH the client and server machines does it?

I wish they showed (perhaps graphically) how the physical deployment looks
on each machine.

In their example the interfaces (Compute and Task) are compiled into a jar
file. This jar must be made available to both the server (remote object,
ComputeEngine in their example), as well as the client (this is the entity
that will be making the request of the remote object).

The remote object (ComputeEngine in the example) also requires stub
(downloaded to the client) and skeleton (remote proxy) classes to make
everything work.

On the client machine:
- Compute.jar
- Client classes: ComputePi.class and Pi.class

??? Where do I need to put these classes?

On the server machine:
- the unarchived Compute.jar files
- the ComputeEngine class file (plus stub and skeleton classes)

In my case, the server machine is running IIS, and I've placed the "server"
classes into a publicly accessible folder. So they can be accessed via the
URL: http://www.mydomain.com/classes/ (mydomain is just an example
obviously).

Might someone please fill in the obvious gaps (or outright mistakes) in my
understanding here?

Thank you very much in advance.

Tom

PS: Before you flame me for not reading the tutorial carefully enough, I
assure you that I did read it several times; I simply can't put all the
pieces together following the given verbiage... ;-(

Tom West

unread,
Dec 18, 2002, 12:13:29 AM12/18/02
to
This is what I have thus far:

On the server (running IIS):

c:\inetpub\wwwroot\classes\
Compute.jar
java.policy
engine\
ComputeEngine.class
ComputeEngine_Skel.class
ComputeEngine_Stub.class

The above policy file contains:
grant {
permission java.net.SocketPermission "*:1024-65535",
"connect,accept";
permission java.io.FilePermission
"c:\\inetpub\\wwwroot\\classes\\-", "read";
permission java.io.FilePermission
"c:\\inetpub\\wwwroot\\classes\\-", "read";
};

I can see the Compute.jar from a web browser by going to
http://www.mydomain.com/classes
[So I know it is accessible]

To start the server side, I first execute rmiregistry using the default port
from an env. where CLASSPATH is not set. Then from a normal env. I start
the server using this command line:

C:\Inetpub\wwwroot\classes>java -Djava.rmi.server.codebase=file:/c:\inetpub\
wwwroot\classes -Djava.rmi.server.hostname=192.168.1.101
\classes -Djava.security.policy=java.policy engine.ComputeEngine

The server starts fine.


On the client:

C:\Java\Mine\RMI_Test\
Compute.jar
java.policy
client\
ComputePi.class
Pi.class

The above policy file contains:
grant {
permission java.net.SocketPermission "*:1024-65535",
"connect,accept";
permission java.io.FilePermission
"c:\\Java\\Mine\\RMI_Test\\-", "read";
permission java.io.FilePermission
"c:\\Java\\Mine\\RMI_Test\\-", "read";
};

I attempt to start the client (from another machine) using this command
line:
c:\Java\Mine\RMI_Test>java -Djava.rmi.server.codebase=file:/c:\java\mine\RMI
_Test\client -Djava.security.policy=java.policy client.ComputePi
192.168.1.101/classes 20

Name: //192.168.1.101/classes/Compute
ComputePi exception: classes/Compute
java.rmi.NotBoundException: classes/Compute
at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:106)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at
sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:342)
at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:7
01)
at java.lang.Thread.run(Thread.java:536)
at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteC
all.java:247)
at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at client.ComputePi.main(ComputePi.java:16)

I have absolutely no clue as to why I am getting an NotBoundException. Is
the client looking for "classes/Compute" instead of just Compute?

"Tom West" <tom_w...@hotmail.com> wrote in message
news:uvvsas8...@corp.supernews.com...

L. Webster

unread,
Dec 18, 2002, 9:17:18 PM12/18/02
to
Your codebase syntax is incorrect. I can't remember if it is two or three
forward slashes after the -Djava.rmi.server.codebase=file:

... but I know it's not just one. I think it's two for Linux and three for
Windows but I can't quite remember. Try...

-Djava.rmi.server.codebase=file://c:\inetpub\wwwroot\classes (two slashes)

...and...

-Djava.rmi.server.codebase=file:///c:\inetpub\wwwroot\classes (three
slashes)

Just one forward slash in the codebase is definately wrong so that may fix
the problem for you right away. If the problem persists, let me know.

Regards,

Lyndon.


0 new messages