0

我得到ClassNotFound异常,这里是代码:

服务器:

<bean id="metaFactoryRmiServiceExporter"
  class="org.springframework.remoting.rmi.RmiServiceExporter">
    <property name="serviceName" value="metaFactoryService"/>
    <property name="service" ref="metaFactoryServiceImpl"/>
    <property name="serviceInterface" value="IMetaFactoryService"/>
    <property name="registryPort" value="1098"/>
</bean>

客户:

if (System.getSecurityManager() == null) {
   System.setSecurityManager(new RMISecurityManager());
}
try {
    Registry registry = LocateRegistry.getRegistry("127.0.0.1",1098);
    registry.lookup("metaFactoryService");
    for (String s:registry.list()) {
        System.out.println(s);
    }
} catch (Exception e) {
    e.printStackTrace();
}

我可以得到registry.list()但查找抛出异常。为什么 ?我已经配置了security.policy。

4

0 回答 0