bignano
bignano

Reputation: 593

java.lang.IllegalArgumentException: unable to serialize myclass

I was using Google Dataflow and have encountered an error of

java.lang.IllegalArgumentException: unable to serialize ...

from SerializableUtils.class even I have serialVersionUID defined. I suspected the reason could be that I import non standard java library which is not listed on JRE Class While List . In my case I import javassist. I just want to confirm this is case.

Upvotes: 1

Views: 1695

Answers (2)

bignano
bignano

Reputation: 593

it turns out that whether or not the imported third party library is on the JRE Class While List has nothing to do with this error. Dataflow runs on compute engine which is not restricted to the app engine white list. The culprit to my error is due to the introduction of a class member which is not serializable even though the the class itself implements Serializable interface.

Upvotes: 1

GhostCat
GhostCat

Reputation: 140525

Serialization is about the fields in your classes - as this is the process of turning an existing Java object into a sequence of bytes; based on the content of that object.

An import within your Java source code is just a hint for the compiler to understand where names are coming from.

In other words: importing class A within source code for class B doesn't necessarily mean that class A will be serialized. You need to have a field of type A within B for that part!

Upvotes: 0

Related Questions