RMI的几点补充

1118人阅读 评论(0) 收藏 举报

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端。

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1685765次
    • 积分:20206
    • 等级:
    • 排名:第392名
    • 原创:492篇
    • 转载:112篇
    • 译文:19篇
    • 评论:217条
    文章存档
    最新评论
    老婆