This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes RMI Stub generation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI Stub generation" Watch "RMI Stub generation" New topic

RMI Stub generation

Michael Andro

Joined: Sep 20, 2010
Posts: 9
Hey everyone,

I know this is an annoying and recurring topic, but as a matter of fact I already invested alot of time to find out why the stub generation is not done. Nothing worked so I will explain my application and environment in detail:

1. Application

The program takes a text file and filters foreign words through two dictionaries. It is a distributed application, in order to balance work load of text fragment analysing on different machines. Thus the application is split into two parts: The main program initializing the workers and the Worker/Filter itself.

2. Structure

The structure is simple in packages: de.fu.alp5.foreign.distributed with the following files: (Main application) (Main application for worker) (Interface (!) which extends Remote) (Interface (!) which extends Remote)

3. Development Environment

On my Windows machine the source code is located at: C:\de\fu\alp5\foreign\distributed

My javac Version is 1.6.0_22, as is my java versio:

java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

Thus dynamic stub generation through proxy substitude should be given as mentioned in the Java 5 Release Notes to RMI. In fact, this happens anyway:

(1) I start rmiregistry inside the classpath C:\

(2) I compile my code:

C:\> javac de\fu\alp5\foreign\distributed\

C:\> javac de\fu\alp5\foreign\distributed\

(3) I execute my code:

C:\>java de.fu.alp5.foreign.distributed.MainWorker
Usage: java -jar ForeignWorker.jar <text file>

Okay, I forgot the text file, no problem:

C:\>java de.fu.alp5.foreign.distributed.MainWorker denglish.txt

And I get the well known Exception:

4. Actions to be taken

When I compile the stubs manually with rmic the application works well. But this is not Java 4 or older, I want to get it running by mondern methods. So what did I do wrong?

(1) Is it the code? I have attached the source code to section 2. It is not much.

(2) I know there is the option -Djava.rmi.server.codebase. I didn't worked, too. Though I wouldn't know what path to give any way, because the needed Interfaces are already in the classpath.


So where is the problem? I don't get it, but I really want it to get running the normal way. I also tried unter Ubuntu, same results.
Michael Andro

Joined: Sep 20, 2010
Posts: 9
The question was answered by a member of the Oracle Java Forum. Here is the solution sweated workers who roam on Google:

The problem is the call to export:

With no given port, an anonymous port will be chosen. The export is not designed to get the stub code via rmiregistry. The stub code has to be provided in a separate way. What I actually wanted was this:

0 means the standard port 1099 will be chosen. Works now like a charm
I agree. Here's the link:
subject: RMI Stub generation
Similar Threads
[newbie] Null pointer exception ??
Exception in thread "main" java. lang. UnsupportedClassVersion Error:
Issues with cmd java command
Problem Executing RMI-IIOP Example : Provided by Sun