JDK-4330871 : RMI registry couldn't be created on several ports within a same JVM
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.rmi
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5
  • CPU: sparc
  • Submitted: 2000-04-17
  • Updated: 2000-04-17
  • Resolved: 2000-04-17
Related Reports
Duplicate :  
Description

Name: acR10002			Date: 04/17/2000


Application couldn't create an RMI registry if it was previously created on a
different port within the same JVM. Below is a short example which demonstrates 
this problem :

--------------------------------- RegTest.java ----------------------------
import java.rmi.RemoteException;
import java.rmi.registry.*;

public class RegTest {
   
    public static void main(String args[]) {

        Registry reg1 = null;
        Registry reg2 = null;
        int port1 = 2098;
        int port2 = 3000;
        boolean passed = true;

        // Create registry on port I
        try {
            reg1 = LocateRegistry.createRegistry(port1);
        } catch (RemoteException e) {
            System.out.println("Failed to create registry on port I : " + e);
            passed = false;
        }
        
        // Create registry on port II
        try {
            reg2 = LocateRegistry.createRegistry(port2);
        } catch (RemoteException e) {
            System.out.println("Failed to create registry on port II : " + e);
            passed = false;
        }
        System.out.println(passed ? "Test passed." : "Test failed.");
        System.exit(0);
    }
}

----------------------------- end of RegTest.java -------------------------

Output from test :
---------------------------------------------------------------------------
% java -version
java version "1.3.0rc3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc3-Z)
Java HotSpot(TM) Client VM (build 1.3.0rc3-Z, interpreted mode)
% javac RegTest.java 
% java RegTest
Failed to create registry on port II : java.rmi.server.ExportException: internal error: ObjID already in 
use
Test failed.
---------------------------------------------------------------------------
The usage of another factory method :
LocateRegistry.createRegistry(int,RMIClientSocketFactory,RMIServerSocketFactory)
will give the same output.

======================================================================

Comments
EVALUATION This is a duplicate of 4267864. ann.wollrath@East 2000-04-17
17-04-2000