两个问题
1.使用RMI在aix服务器端发布一个方法,java这边调用aix服务器端暴露出来的方法时,需要登录吗?
2.如果不需要登录,该如何调用,我本地用两台window机器,一台做服务器,一台就客户端是可以访问的。不知道为什么到aix上就不行了。。
贴一下错误信息,求大神帮忙啊!!!
错误信息:Error:java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: 
java.net.SocketTimeoutException: Read timed out

解决方案 »

  1.   

    rmi需要在服务端开放端口,默认好像是1099。
      

  2.   

    我贴一下服务器端和客户端的代码
    服务器端:
    public class AgentServer { public static void main(String[] args)  {

    try {
    //注册服务
    LocateRegistry.createRegistry(1099);
    //暴露为一个接口
    AgentInterface agInterface=new AgentInterfactImpl();
    //绑定方法
    Naming.rebind("agInterface", agInterface);

    System.out.println("agInterface Server is Readly!");
    } catch (Exception e) {
    System.out.println("Server exception:"+e);
    }
    }
    }客户端:
    public static void main(String[] args) {
    try {
    AgentInterface rmi =(AgentInterface)Naming.lookup("rmi://10.192.30.7:1099/agInterface");

    System.out.println(rmi.sayHello("Jono"));

    } catch (Exception e) {
    System.out.println("Error:"+e);
    }
    }接口和方法的实现都没有问题,我在自己本机上测试过!求大手!!