RMI的几点补充

1.localhost不能用于RMI,如果想在单一机器上测试RMI,得指定机器名称。

2.除非你的电脑有一个活动的TCP/IP连线,否则RMI机制不会运作。即使所有的组件都只和本机进行通信,也不例外。

3.eclipse下有一些插件,比如rmiplugin,可以便于rmi的开发。http://sourceforge.net/project/showfiles.php?group_id=163674

4.java.security.AccessControlException: access denied (java.net.SocketPermission 111.111.111.11:7099 connect,resolve) 出现这个异常是因为权限的问题,可以参照下面解决,在java home下面的lib/java.policy中增加设置。

When you use Java2 and its successors, you have a security
model that provides stronger access control to system resources
such as files and sockets. The Security Manager enforces the
restrictions you impose in your security policy (defined in
the java.policy file) - disabling the security manager just
means that you are turning off security checks so the errors
don't show up anymore.


In your case, I assume you haven't set up a java policy file
to provide the appropriate access permissions for your system.

Check out
http://java.sun.com/products/jdk/1.2/docs/guide/security/PolicyFiles.html
http://java.sun.com/products/jdk/1.2/docs/guide/security/permissions.html
for more information.


For an immediate solution, try adding these lines to your java policy file
  permission java.net.SocketPermission "localhost:1024-65535","accept,connect,resolve,listen";
  permission java.net.SocketPermission "*:1024-65535","connect,accept,resolve";

5.在其他机器上执行RMIClient时,需要OperateImpl_stub.class,这个和接口都需要放置在client端。

6.stub类的生成可以通过指定rmic -d <directroy> 来生成到其他目录,便于一起提供给client端。

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wonder4/article/details/818597
个人分类: java理论与实践
上一篇WebLogic8.1下配置RMI的一个例子
下一篇OCP证书到了
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭