一开始我想声明rmi正在工作,当我没有配置bean来使用我的remoteInvocationFactory时。
我的结构:
我有2个Web应用程序,都有嵌入式osgi框架(equinox 3.9),
WebAppServer - 在其osgi中,有一个捆绑包,它将osgi服务导出为rmi服务,
WebAppClient - 在其osgi中,有捆绑,消耗rmi服务
两个webapps都使用spring dm(gemini-blueprint 2.0.0.M02)
在WebAppServer中我通过实例化RmiServiceExporter
并在其上调用prepare()来导出rmi。
在客户端(WebAppClient),这就是我如何定义rmi代理bean,在bundle内部
<bean id="authorizationService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean" scope="prototype">
<property name="serviceUrl" value="rmi://localhost:1099/xxx/AuthorizationService"/>
<property name="serviceInterface" value="xxx.AuthorizationService"/>
<property name="refreshStubOnConnectFailure"><value>true</value></property>
<property name="lookupStubOnStartup"><value>false</value></property>
</bean>
如前所述,如果我想指定自定义远程调用工厂,我可以成功调用该服务,问题开始了:
<property name="remoteInvocationFactory"><ref bean="remoteInvocationFactory"/></property>
工厂提供MyCustomRemoteInvocation
现在,当我调用服务时,我得到了
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: xxx.MyCustomRemoteInvocation cannot be found by org.springframework.context_3.2.3.RELEASE (no security manager: RMI class loader disabled)
我不想启用rmi类加载器,缺少类可用于服务实现, (它是通过在osgi框架中安装的bundle导出的),我试过在其他地方导入它,但没有运气,有什么想法吗?