java - Spring RMI错误java.lang.ClassNotFoundException : org. springframework.remoting.rmi.RmiInvocationHandler

标签 java spring jakarta-ee classloader rmi

我正在尝试使用 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/

相关文章:

java - Gson反序列化时失败 "understand"泛型类型

java - 使用 Spring、Hibernate、JSP 创建下拉列表

SpringMVC 应用程序...为什么应用程序上下文被初始化两次?

java - 防止 Dozer 触发 Hibernate 延迟加载

java - 可用的 Servlet 3.0 实现?

java - 使用 args.length 而不是 nums.length

java - 创建项目之间的依赖关系

java - CN1 : Scrolling not working on MultiButton

java - 如何在java中基于数据库中的字段创建表单?

jakarta-ee - 如何编写可扩展的 java-ee 应用程序