激活远程对象时存根的ClassNotFoundException

时间:2016-01-14 06:51:41

标签: java rmi classnotfoundexception

 public void Test {
    String location = xyz; //location of the class file for the stub
    ActivationDesc desc = new ActivationDesc( "TestObjectImpl", location, null);
    ActivationID id = ActivationGroup.getSystem().registerObject(desc);
    TestObject to = (TestObject)id.activate(true);
 }

在运行上面的代码时,我得到了TestObjectImpl_stub的ClassNotFoundException。我环顾网络,发现了两种可能的解决方法:

  1. 在CLASSPATH变量中指定类文件的路径。
  2. 执行测试时,请提及java.rmi.server.codebase = location以及java命令,location是类文件的位置。
  3. 以上哪种方法更合适?对此有更好的解决方案吗?

0 个答案:

没有答案
相关问题