我正在尝试使用 Spring
创建一些 bean 并将它们导出到 RMI...
这是我的代码:
<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="serviceName" value="OfferService" />
<property name="service" ref="offerService" />
<property name="serviceInterface" value="ro.project.services.OfferService" />
<property name="registryPort" value="1199" />
</bean>
我在我的根文件夹中创建了一个名为“policy.all”的文件,我正在使用该参数运行我的虚拟机,但我仍然有这个错误:
java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiInvocationHandler (no security manager: RMI class loader disabled)
我不知道该怎么做...在 linux 中,完全相同的项目运行正常(使用 jdk 1.7.0.4)但在 windows 中不行...在 java 1.5 (windows) 中它正在工作..但是在java 1.7.0.4 (windows) 它不工作...
已编辑:
我的错误是:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.remoting.rmi.RmiServiceExporter#0' defined in class path resource [spring/services.xml]: Invocation of init method failed; nested exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiInvocationHandler (no security manager: RMI class loader disabled)
添加此行后:
if (System.getSecurityManager() == null)
{
RMISecurityManager manager = new RMISecurityManager();
System.setSecurityManager(manager);
}
我有这个错误:
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring/application-context.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring/application-context.xml] cannot be opened because it does not exist
提前谢谢你
最佳答案
这里的重点不是安装安全管理器而是找到类。您的部署中缺少一些 JAR 文件。
关于java - Spring RMI错误java.lang.ClassNotFoundException : org. springframework.remoting.rmi.RmiInvocationHandler,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10721062/