The problem
Problem with Spring 4.3.3 and Java 8 when project uses RMI. Application throws exception during using RMI to send event to other application. It was working fine (application is few years old) but it broke after some patch installation on Weblogic server.
The code
The application uses spring-context
org.springframework.context.support.AbstractApplicationContext
private void publishEvent(final ApplicationEvent event) {
taskExecutor.submit(new Runnable() {
@Override
public void run() {
publisher.publishEvent(event);
}
});
}
The logs
> 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