If a host has a network interface configured with multiple logical interfaces, Naming.rebind() fails. For example, I have a host phys-hoho with IP address 192.9.76.8 on controller le2. When I configure two additional logical interfaces on the same controller using ifconfig(1), Naming.rebind() fails. I set the logical interfaces to be le2:1, le2:2 and le2:3 with IP addresses 192.9.76.123, 192.9.76.124 and 192.9.76.125 and configure them up.
I get following error from my program:
Test.main - url is //phys-hoho/Test
Test.main - Server RemoteException; nested exception is:
java.rmi.AccessException: Registry.rebind 192.9.76.125/192.9.76.125 != phys-hoho/192.9.76.8
java.rmi.ServerException: Server RemoteException; nested exception is:
java.rmi.AccessException: Registry.rebind 192.9.76.125/192.9.76.125 != phys-hoho/192.9.76.8
My code follows:
---------------------- TestI.java ------------------------------
import java.rmi.*;
import java.rmi.server.*;
import java.util.*;
import java.lang.*;
import java.net.*;
public interface TestI extends java.rmi.Remote {
public void aMethod() throws java.rmi.RemoteException;
}
------------------ Test.java ------------------------------------
import java.rmi.*;
import java.rmi.server.*;
import java.util.*;
import java.lang.*;
import java.net.*;
public class Test
extends java.rmi.server.UnicastRemoteObject
implements TestI, java.io.Serializable
{
public Test()
throws java.rmi.RemoteException {
}
public synchronized void aMethod() {
}
public static void main(String args[]) {
System.setSecurityManager(new RMISecurityManager());
try {
Test test = new Test();
InetAddress addr = InetAddress.getLocalHost();
String url = new String("//" + addr.getHostName() +
"/Test");
System.out.println("Test.main - url is " + url);
Naming.rebind(url, test);
} catch (java.net.UnknownHostException ex) {
System.out.println ("Test.main - Host unknown");
ex.printStackTrace();
} catch (java.net.MalformedURLException ex) {
System.out.println("Test.main - " + ex.getMessage());
ex.printStackTrace();
} catch (java.rmi.UnknownHostException ex) {
System.out.println("Test.main - " + ex.getMessage());
ex.printStackTrace();
} catch (java.rmi.RemoteException ex) {
System.out.println("Test.main - " + ex.getMessage());
ex.printStackTrace();
}
}
}
I get following error from my program:
Test.main - url is //phys-hoho/Test
Test.main - Server RemoteException; nested exception is:
java.rmi.AccessException: Registry.rebind 192.9.76.125/192.9.76.125 != phys-hoho/192.9.76.8
java.rmi.ServerException: Server RemoteException; nested exception is:
java.rmi.AccessException: Registry.rebind 192.9.76.125/192.9.76.125 != phys-hoho/192.9.76.8
My code follows:
---------------------- TestI.java ------------------------------
import java.rmi.*;
import java.rmi.server.*;
import java.util.*;
import java.lang.*;
import java.net.*;
public interface TestI extends java.rmi.Remote {
public void aMethod() throws java.rmi.RemoteException;
}
------------------ Test.java ------------------------------------
import java.rmi.*;
import java.rmi.server.*;
import java.util.*;
import java.lang.*;
import java.net.*;
public class Test
extends java.rmi.server.UnicastRemoteObject
implements TestI, java.io.Serializable
{
public Test()
throws java.rmi.RemoteException {
}
public synchronized void aMethod() {
}
public static void main(String args[]) {
System.setSecurityManager(new RMISecurityManager());
try {
Test test = new Test();
InetAddress addr = InetAddress.getLocalHost();
String url = new String("//" + addr.getHostName() +
"/Test");
System.out.println("Test.main - url is " + url);
Naming.rebind(url, test);
} catch (java.net.UnknownHostException ex) {
System.out.println ("Test.main - Host unknown");
ex.printStackTrace();
} catch (java.net.MalformedURLException ex) {
System.out.println("Test.main - " + ex.getMessage());
ex.printStackTrace();
} catch (java.rmi.UnknownHostException ex) {
System.out.println("Test.main - " + ex.getMessage());
ex.printStackTrace();
} catch (java.rmi.RemoteException ex) {
System.out.println("Test.main - " + ex.getMessage());
ex.printStackTrace();
}
}
}
- relates to
-
JDK-4165495 (1.x) registry's checkAccess refuses clients from multi-homed hosts
-
- Closed
-