Forums Register Login
SCJD RMI Practice
Hi people,

I'm practicing some RMI concepts on a pc (lets call it pc A) a simple Hello World test for my SCJD. It works fine. The problem is when i try to start the client from another pc (pc B).

Steps on pc A (server):
I compile the server object, client object and interface.
I create the stub file using >rmic ServerImpl
I start the registry with >start rmiregistry.
I start the server.

note: in the client object i have the following:

HelloInterface server = (HelloInterface)Naming.lookup("rmi://");

the ip address is the LAN ip of the server.

Steps on pc B (client):
Copy the generated client.class file from the server to the client (pc B).
I run the client and it says it cannot find HelloInterface (which is on the server (pc A).

note: the server is run with JRE 1.4 and the client runs with JRE 1.5.

Where am i going wrong?

Thanks in advance and regards,
I am working through my SCJD as well. I found there can be a lot of small gotchas. To start with, are you copying all the class files to the new server? And don't forget the stub files.

All of the files are on the server, even the client, but then i copy the client.class file and put it in the client pc (pc B acording to my example) and try to run it.

Am i doing it the right way?

I'm getting the following error:

NoClassDefFoundError: InterfaceFile

It's like it can't find the remote interface file (or it can't find the stub over the LAN).

Thanks in advance,
did you copy Your Remote interface (your compiled .class extention of the Remote interface that acts as the contract between the client and the server) and the stub file generated by rmic utility into PC B?
Actually no, i didn't. Must i?
Could you post the actual error? I expect that it is telling you that it cannot find the stub class.
The error i was first getting when i started the client was the folowing:

NoClassDefFoundError: interfaceFile

So then i copied both the compiled client.class file and the interface.class file to the client.

But now i get i security error. Client machine has JRE 1.5 and server has 1.4.

Any ideas?
I'm not getting the security error any more because i copied the interface file AND the stub file to my client machine, now it runs like acharm.

Thanks and best regards,
it's a teeny, tiny, wafer thin ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database

This thread has been viewed 979 times.

All times above are in ranch (not your local) time.
The current ranch time is
Feb 22, 2019 09:57:17.