“问题是”
当项目使用RMI时,Spring 4.3.3和Java 8出现问题。在使用RMI将事件发送到其他应用程序期间,应用程序引发异常。它工作正常(应用程序已存在几年),但在Weblogic服务器上安装一些修补程序后,它中断了。
"密码"
应用程序使用spring-context
org.springframework.context.support.AbstractApplicationContext
private void publishEvent(final ApplicationEvent event) {
taskExecutor.submit(new Runnable() {
@Override
public void run() {
publisher.publishEvent(event);
}
});
}
日志
> 2019-10-01 10:42:14,366 ERROR .c.b.i.i.ImportServiceImpl - An unexpected error occurred during the synchronous import process.
org.springframework.remoting.RemoteLookupFailureException: Lookup of RMI stub failed; nested exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.InvalidClassException: filter status: REJECTED
at org.springframework.remoting.rmi.RmiClientInterceptor.lookupStub(RmiClientInterceptor.java:215)
at org.springframework.remoting.rmi.RmiClientInterceptor.getStub(RmiClientInterceptor.java:237)
at org.springframework.remoting.rmi.RmiClientInterceptor.invoke(RmiClientInterceptor.java:258)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
(...)
> Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.InvalidClassException: filter status: REJECTED
at sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:125)
at java.rmi.Naming.lookup(Naming.java:101)
at org.springframework.remoting.rmi.RmiClientInterceptor.lookupStub(RmiClientInterceptor.java:200)
... 104 common frames omitted
Caused by: java.io.InvalidClassException: filter status: REJECTED
at java.io.ObjectInputStream.filterCheck(ObjectInputStream.java:1255)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1878)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1751)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2042)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2287)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2211)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2069)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
at sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:123)
... 106 common frames omitted
3条答案
按热度按时间oyt4ldly1#
我在类似的情况下使用了上面提出的解决方案,它对我很有效:
您可以在此处找到Weblogic设置的说明。
aor9mmx12#
当我从weblogic www.example.com迁移到weblogic 12.2.1.4时,我遇到了同样的情况12.1.3.0。最终,我将weblogic服务器调试到java.io.ObjectInputStream #filterCheck,在调试中,我可以看到正在使用的过滤器。
非常奇怪的是,weblogic 12.2.1.4附带了一个预设的过滤器,该过滤器不允许序列化java.rmi.server.* 类。
因此,对我有效的修复方法是将整个包添加到允许的过滤器:
Oracle文档解释说,默认行为将是“合并”,我们定义的内容将优先于预定义的过滤器。
(窗口)
(* 无)
wnvonmuf3#
我确实看到了同样的事情,不是在Spring框架中,而是在WebLogic中部署基于servlet的rmi。
我改了密码
import java.rmi.server.*;
并添加了系统属性
这起作用了。