# rmi-demo **Repository Path**: liumengjun/rmi-demo ## Basic Information - **Project Name**: rmi-demo - **Description**: java rmi简单示例 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-05-09 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README More detailed instructions on how to compile/run this example can be found in the sample top-level README file. The following urls have more information about RMI and the HelloWorld example: http://java.sun.com/j2se/1.5.0/docs/guide/rmi/index.html http://java.sun.com/docs/books/tutorial/rmi/index.html rmi Hello.java HelloImpl.java RMISSLClientSocketFactory.java RMISSLServerSocketFactory.java HelloClient.java This example illustrates how to use RMI over an SSL transport layer using JSSE. The server runs HelloImpl, which sets up an internal RMI registry (rather than using the rmiregistry command). The client runs HelloClient and communicates over a secured connection. Setting up this sample can be a little tricky, here are the necessary steps: % javac *.java % rmic HelloImpl % java \ -Djava.security.policy=policy \ HelloImpl (run in another window) % java HelloClient (run in another window) For the server, the RMI security manager will be installed, and the supplied policy file grants permission to accept connections from any host. Obviously, giving all permissions should not be done in a production environment. You will need to give it the appropriate restrictive network privileges, such as: permission java.net.SocketPermission \ "hostname:1024-", "accept,resolve"; In addition, this example can be easily updated to run with the new standard SSL/TLS-based RMI Socket Factories. To do this, modify the HelloImpl.java file to use: javax.rmi.ssl.SslRMIClientSocketFactory javax.rmi.ssl.SslRMIServerSocketFactory instead of: RMISSLClientSocketFactory RMISSLServerSocketFactory These new classes use SSLSocketFactory.getDefault() and SSLServerSocketFactory.getDefault(), so you will need to configure the system properly to locate your key and trust material. NOTES FOR RUNNING WITH SUN's JDK: --------------------------------- If you use the new classes mentioned above, you can specify the key stores using the System properties: -Djavax.net.ssl.keyStore=testkeys -Djavax.net.ssl.keyStorePassword=passphrase