I got a customer(SAP) call that they find they cannot use HTTP Tunnel (RMIHttpToPortSocketFactory) to bind the RMI Server. After testing and some investigation, I find this problem just happens to jdk1.5.0_08 or later. If we are using HTTP Tunnel directly, we will raise an exception in sun.rmi.registry.RegistryImpl.checkAccess:
Below is the code from sun.rmi.registry.RegistryImpl.checkAccess (jdk1.5.0_10)
// if client not yet seen, make sure client allowed access
if (allowedAccessCache.get(clientHost) == null) {
LINE:204 if (clientHost.isAnyLocalAddress()) {
LINE:205 throw new AccessException(
"Registry." + op + " disallowed; origin unknown");
}
I find clientHost is always specified with "0.0.0.0" which result in the throw AccessException.
Since HTTP Tunneling is very important feature for RMI, it's unbelievable to release jdk with this exception to prevent ISV/Customer from this feature. Thereforce I choose the first grade of priority for this RFE.
The output of sample program is:
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.AccessException: Registry.Registry.rebind disallowed; origin un
known
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385
)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
66)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:671)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
RemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:343)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at MyServer.main(MyServer.java:41)
*_Caused by: java.rmi.AccessException: Registry.Registry.rebind disallowed; origin
unknown_*
at sun.rmi.registry.RegistryImpl.checkAccess(RegistryImpl.java:205)
at sun.rmi.registry.RegistryImpl.rebind(RegistryImpl.java:152)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375
)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
66)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:671)
at java.lang.Thread.run(Thread.java:595)
Below is the code from sun.rmi.registry.RegistryImpl.checkAccess (jdk1.5.0_10)
// if client not yet seen, make sure client allowed access
if (allowedAccessCache.get(clientHost) == null) {
LINE:204 if (clientHost.isAnyLocalAddress()) {
LINE:205 throw new AccessException(
"Registry." + op + " disallowed; origin unknown");
}
I find clientHost is always specified with "0.0.0.0" which result in the throw AccessException.
Since HTTP Tunneling is very important feature for RMI, it's unbelievable to release jdk with this exception to prevent ISV/Customer from this feature. Thereforce I choose the first grade of priority for this RFE.
The output of sample program is:
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.AccessException: Registry.Registry.rebind disallowed; origin un
known
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385
)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
66)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:671)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
RemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:343)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at MyServer.main(MyServer.java:41)
*_Caused by: java.rmi.AccessException: Registry.Registry.rebind disallowed; origin
unknown_*
at sun.rmi.registry.RegistryImpl.checkAccess(RegistryImpl.java:205)
at sun.rmi.registry.RegistryImpl.rebind(RegistryImpl.java:152)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375
)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
66)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:671)
at java.lang.Thread.run(Thread.java:595)