Mr_Thorynque
Mr_Thorynque

Reputation: 2002

Apache ignite failed to deserialize object

Environment :

After some time on tomcat8 the web application user Ignite to handle http session do that kind of error. Always on the same type. But it works at the begining.

SequenceEditableList class inherite of Arraylist<>

   Caused by: org.apache.ignite.IgniteCheckedException: Failed to deserialize object with given class loader: [clsLdr=ParallelWebappClassLoader
  context: xxxxxx
  delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@4277127c
, err=Failed to deserialize object [typeName=com.xxxx.web.common.list.SequenceEditableList]]
        at org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller.unmarshal0(OptimizedMarshaller.java:261)
        at org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller.unmarshal0(OptimizedMarshaller.java:225)
        at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:92)
        at org.apache.ignite.internal.binary.BinaryUtils.doReadOptimized(BinaryUtils.java:1816)
        ... 137 common frames omitted
Caused by: java.io.IOException: Failed to deserialize object [typeName=com.xxxx.web.common.list.SequenceEditableList]
        at org.apache.ignite.internal.marshaller.optimized.OptimizedObjectInputStream.readObject0(OptimizedObjectInputStream.java:357)
        at org.apache.ignite.internal.marshaller.optimized.OptimizedObjectInputStream.readObjectOverride(OptimizedObjectInputStream.java:205)
        at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:484)
        at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:451)
        at org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller.unmarshal0(OptimizedMarshaller.java:251)
        ... 140 common frames omitted
Caused by: java.io.IOException: java.lang.reflect.InvocationTargetException
        at org.apache.ignite.internal.marshaller.optimized.OptimizedObjectInputStream.readSerializable(OptimizedObjectInputStream.java:611)
        at org.apache.ignite.internal.marshaller.optimized.OptimizedClassDescriptor.read(OptimizedClassDescriptor.java:985)
        at org.apache.ignite.internal.marshaller.optimized.OptimizedObjectInputStream.readObject0(OptimizedObjectInputStream.java:353)
        ... 144 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
        at java.base/jdk.internal.reflect.GeneratedMethodAccessor169.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.ignite.internal.marshaller.optimized.OptimizedObjectInputStream.readSerializable(OptimizedObjectInputStream.java:608)
        ... 146 common frames omitted
Caused by: java.io.InvalidClassException: filter status: REJECTED
        at java.base/java.io.ObjectInputStream.filterCheck(ObjectInputStream.java:1356)
        at java.base/java.io.ObjectInputStream.checkArray(ObjectInputStream.java:1386)
        at java.base/java.util.ArrayList.readObject(ArrayList.java:924)
        ... 150 common frames omitted

Upvotes: 0

Views: 1844

Answers (1)

Stanislav Lukyanov
Stanislav Lukyanov

Reputation: 2157

What happens is that your class loader rejects the class SequenceEditableList.

The class is rejected because of serialization filtering. This mechanism is there to protect from many serialization vulnerabilities that caused problems in Java since the dawn of time.

The fix would be to find if your application already sets jdk.serialFilter system property anywhere. Ignite doesn't do that but maybe the application code or Tomcat do. Judging from the error, there must be this property somewhere.

When you've found where the property is defined, add your class to the allowed patterns. Like:

-Djdk.serialFilter=...;com.xxxx.web.common.list.SequenceEditableList

There aren't many details in the question, so it's hard to tell why it works in the beginning but fails after some time. Most likely it's because the classes are being deserialized in a different route (by a different class loader), or there just isn't an instance of SequenceEditableList that you need to deserialize. You could analyze.

Upvotes: 1

Related Questions