stub文件是要和class文件放在一起的。

解决方案 »

  1.   

    一些常见的RMI异常及处理办法:
    1.
    problem: You get a "class not found" error when running rmic
    solution: Add the current directory to your classpath.2.
    problem: You get the following error when running the clientException occured: java.rmi.UnmarshalException: Return value class not found; nested exception is:
            java.lang.ClassNotFoundException: myRMIImpl_Stubsolution: The file myRMIImpl_Stub.class must be deployed with your client application (that is, you must place it somewhere in the classpath of the client machine; If you were using an applet as a client, you would place it in the directory specified in the CODEBASE parameter to achieve the same effect).3.
    problem: You get the following error when running the clientC:\test3>java myRMIClient 127.0.0.1
    Exception occured: java.security.AccessControlException: access denied (java.net
    .SocketPermission 127.0.0.1:1099 connect,resolve)or the following when running the server
    C:\test3>java myRMIServer
    Exception occurred: java.security.AccessControlException: access denied (java.ne
    t.SocketPermission 127.0.0.1:1099 connect,resolve)solution: I experienced this problem under Java2 with the default security policy in place. You'll need to modify your security policy to allow these activities to take place. A full writeup on this is available at The Sun RMI tutorial page.
    In summary, you'll need to do the following:
    (1)Create a new security policy file. See your JDK docs or the links referenced from the Sun RMI tutorial for more information on this.
    (2)When you run the client or the server, pass the location of your new security policy file in as an argument. This allows you to run under a new policy without having to modify your system policy files. Here is a .policy file that grants all permissions to everybody. DO NOT install this policy file in a production system. However, you can use it in trivial testing. You can then run the server with the command line
    java -Djava.security.policy=c:\test3\wideopen.policy myRMIServer
    or the client with
    java -Djava.security.policy=c:\test3\wideopen.policy myRMIClient 127.0.0.1
    Of course, you'd replace c:\test3\wideopen.policy with the full path to your own properties file.
    Here is another policy file that includes only the permissions necessary to run this app.
      

  2.   

    At all,thank for zcjl() very much.Now,the problem was has been  resolved.It was cuased by classpath environment and I set the right claspath and pass successufully.When java classload load a java file,if some needed jar not include in current classpath,the java compileing will report the error " class is not found". zcjl() syas that is very complete,I thank for him again.