Java 使用Spring RMI的ClassNotFoundException

Java 使用Spring RMI的ClassNotFoundException,java,spring,rmi,Java,Spring,Rmi,我有两个项目(客户端和服务器)试图通过EclipseHelios中的SpringRMI交换一些对象。客户端只知道它们的接口。类似的传递字符串的程序工作正常 我正在关注SpringInAction的第三版示例,而不是Spitter首选的Twitter:)对象在服务器上运行良好,没有人知道实现,只有Spring。奇怪的是,它抛出了一个ClassNotFoundException,似乎客户机在抱怨他不知道TwitterImpl 提前感谢您的帮助 堆栈跟踪: Exception in thread "m

我有两个项目(客户端和服务器)试图通过EclipseHelios中的SpringRMI交换一些对象。客户端只知道它们的接口。类似的传递字符串的程序工作正常

我正在关注SpringInAction的第三版示例,而不是Spitter首选的Twitter:)对象在服务器上运行良好,没有人知道实现,只有Spring。奇怪的是,它抛出了一个ClassNotFoundException,似乎客户机在抱怨他不知道TwitterImpl

提前感谢您的帮助

堆栈跟踪:

Exception in thread "main" org.springframework.remoting.RemoteAccessException: Could not access remote service [rmi://localhost/TwitterService]; 
nested exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is: 
java.lang.ClassNotFoundException: twitter.domain.TwitterImpl (no security manager: RMI class loader disabled)
at org.springframework.remoting.rmi.RmiClientInterceptorUtils.convertRmiAccessException(RmiClientInterceptorUtils.java:193)
at org.springframework.remoting.rmi.RmiClientInterceptor.doInvoke(RmiClientInterceptor.java:347)
at org.springframework.remoting.rmi.RmiClientInterceptor.invoke(RmiClientInterceptor.java:259)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy1.getTwitter(Unknown Source)
at twitter.Retrieve.getTwits(Retrieve.java:31)
at twitter.Main.main(Main.java:30)
客户端rmi.xml

<bean class="org.springframework.remoting.rmi.RmiProxyFactoryBean"
    id="twitterService">
<property name="serviceUrl"
    value="rmi://localhost/TwitterService">
</property>
<property name="serviceInterface"
    value="twitter.service.TwitterService">
</property>


</bean>
<bean id="retrieve" class="twitter.Retrieve">
    <property name="twitterService" ref="twitterService"></property>
</bean>

服务器rmi.xml

<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
    <property name="service" ref="twitterService" />
    <property name="serviceName" value="TwitterService" />
    <property name="serviceInterface" value="twitter.service.TwitterService" />
</bean>
<bean class="twitter.service.TwitterServiceImpl" id="twitterService">
    <property name="twits">
        ...
    </property>
    <property name="twitters">
        ...
    </property>
</bean>

...
...

我完全没有误解RMI的概念。我认为客户端甚至不应该知道类的实现,从服务器接收字节码。事实上,远程处理的目的是访问远程对象的状态,客户端需要知道实现。抛出ClassNotFound异常并不奇怪。

我完全误解了RMI的概念。我认为客户端甚至不应该知道类的实现,从服务器接收字节码。事实上,远程处理的目的是访问远程对象的状态,客户端需要知道实现。抛出ClassNotFound异常并不奇怪