• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

RMI Stub generation

Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

MainAnalyzer.java (Main application)
MainWorker.java (Main application for worker)
TextAnalyzer.java (Interface (!) which extends Remote)
TextAnalyzerWorker.java (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\MainAnalyzer.java

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

(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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 brought this back from the farm where they grow the tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic