Name: krC82822 Date: 03/14/2001
rmi 1193>java -version
java version "1.3.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_01)
Java HotSpot(TM) Client VM (build 1.3.0_01, mixed mode)
Replacing the rmi/RMISSLServerSocketFactory class with one
that uses a default SSLServerSocketFactory instance causes
the example to fail. Here is the RMISSLServerSocketFactory2
replacement:
import java.io.IOException;
import java.io.Serializable;
import java.net.ServerSocket;
import java.rmi.server.RMIServerSocketFactory;
import java.security.KeyStore;
import javax.net.ServerSocketFactory;
import javax.net.ssl.SSLServerSocketFactory;
public class RMISSLServerSocketFactory2 implements Serializable,
RMIServerSocketFactory
{
/** Create a server socket on the specified port.
* @param port the port number, 0 indicates an anonymous port
* @return the server socket on the specified port
* @exception IOException if an I/O error occurs during server socket
* creation
*/
public ServerSocket createServerSocket(int port) throws IOException
{
ServerSocketFactory ssf = null;
try
{
ssf = SSLServerSocketFactory.getDefault();
System.out.println("Got default SSLServerSocketFactory");
}
catch(Exception e)
{
e.printStackTrace();
throw new IOException("Failed to get default
SSLServerSocketFactory, "+e.getMessage());
}
ServerSocket ss = ssf.createServerSocket(port);
System.out.println("Created ss="+ss);
return ss;
}
}
Running the client and server with javax.net.debug=all on the
server shows it sitting in some loop trying to register the
server and the client fails to find the server in the registry.
rmi 1195>java -Djava.rmi.server.codebase="file:/usr/local/Java/jsse1.0.2/sample
s/rmi/" -Djavax.net.debug=all HelloImpl
...
Got default SSLServerSocketFactory
Created ss=[SSL: ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=3088]]
Finalizer, SEND SSL v3.1 ALERT: warning, description = close_notify
Finalizer, WRITE: SSL v3.1 Alert, length = 2
Finalizer, SEND SSL v3.1 ALERT: warning, description = close_notify
Finalizer, WRITE: SSL v3.1 Alert, length = 2
lib 1353>rmiregistry
SSLSocket =504653[SSL_NULL_WITH_NULL_NULL: Socket[addr=succubus-si/172.17.66.54,
port=3088,localport=3090]]
rmi 1477>java HelloClient
HelloClient exception: HelloServer
java.rmi.NotBoundException: HelloServer
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
RemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:354)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at HelloClient.main(HelloClient.java:29)
rmi 1478>
The original example RMISSLServerSocketFactory works fine. What
in the RMISSLServerSocketFactory setup steps are required for the
example to work with rmiregistry?
(Review ID: 118270)
======================================================================
###@###.### 10/11/04 17:29 GMT