2
我有兩個項目(客戶端和服務器)試圖通過Eclipse Helios中的Spring RMI交換一些對象。客戶端只知道他們的接口。傳遞字符串的類似程序工作正常。使用Spring RMI的ClassNotFoundException
我下面春天在行動的第三版例子和,而不是Spitter首選Twitter的:)的對象在服務器正常工作,也沒有人知道的實現,只是春天。奇怪的是,它拋出了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>
+1「noobily」 –