创建bean并获取java.rmi.UnmarshalException时出错

问题描述

我是Java的新手rmi.i使用此applicationContext.xml编写了简单的rmi helloworld应用程序:

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    <bean id="helloService" class="com.rmi.server.example.server.HelloServiceImpl">
    </bean>
    <bean id="rmiServiceExporter" class="org.springframework.remoting.rmi.RmiServiceExporter">
        <property name="serviceName" value="HelloService"/>
        <property name="service" ref="helloService"/>
        <property name="serviceInterface" value="com.rmi.server.example.shared.HelloService"/>
        <!-- defaults to 1099 -->
        <property name="registryPort" value="1099"/>
    </bean>
</beans>

我的tomcat日志是:

12-Sep-2020 12:21:27.668 SEVERE [http-nio-9090-exec-29] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rmiServiceExporter' defined in ServletContext resource [/WEB-INF/applicationContext.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.io.InvalidClassException: filter status: REJECTED
Caused by:  java.rmi.ServerException: remoteexception occurred in server thread; nested exception is: 
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
    java.io.InvalidClassException: filter status: REJECTED
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:389)
        at sun.rmi.transport.Transport$1.run(Transport.java:200)
        at sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at 

有人有想法吗,或者他们可以帮助我吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)