最后倒数第五行写错,应该是java.policy。

解决方案 »

  1.   

    这是生成的框架结构程序文件HelloImpl_Skel.java文件(出错的地方已经标注出来):// Skeleton class generated by rmic, do not edit.
    // Contents subject to change without notice.public final class HelloImpl_Skel
        implements java.rmi.server.Skeleton
    {package examples.hello;    private static final java.rmi.server.Operation[] operations = {
    new java.rmi.server.Operation("java.lang.String sayHello()")
        };
        
        private static final long interfaceHash = 6486744599627128933L;
        
        public java.rmi.server.Operation[] getOperations() {
    return (java.rmi.server.Operation[]) operations.clone();
        }
        
        public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash)
    throws java.lang.Exception
        {
    if (opnum < 0) {
        if (hash == 6043973830760146143L) {
    opnum = 0;
        } else {
    throw new java.rmi.UnmarshalException("invalid method hash");
        }
    } else {
        if (hash != interfaceHash)
    throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
    }

    examples.hello.HelloImpl server = (examples.hello.HelloImpl) obj;
    //就是上面这一句出错:错误提示是:
    //*"HelloImpl_Skel.java": Error #: 302 : cannot access class examples.hello.HelloImpl; java.io.IOException: class not found: class examples.hello.HelloImpl at line 33, column 17*//
    //*"HelloImpl_Skel.java": Error #: 302 : cannot access class examples.hello.HelloImpl; java.io.IOException: class not found: class examples.hello.HelloImpl at line 33, column 52*//
    switch (opnum) {
    case 0: // sayHello()
    {
        call.releaseInputStream();
        java.lang.String $result = server.sayHello();
        try {
    java.io.ObjectOutput out = call.getResultStream(true);
    out.writeObject($result);
        } catch (java.io.IOException e) {
    throw new java.rmi.MarshalException("error marshalling return", e);
        }
        break;
    }
        
    default:
        throw new java.rmi.UnmarshalException("invalid method number");
    }
        }
    }
      

  2.   

    会不会时策略文件写错了?我已经把策略文件加到JPR工程文件里了。