阿帕奇弗林克 1.4.2 com.esotericsoftware.kryo.KryoException:java.lang.UnsupportedOperationException

Apache Flink 1.4.2 com.esotericsoftware.kryo.KryoException: java.lang.UnsupportedOperationException

使用 Apache Flink 1.4.2 我得到以下异常

com.esotericsoftware.kryo.KryoException: java.lang.UnsupportedOperationException
Serialization trace:
data (org.apache.flink.api.java.utils.ParameterTool)
parameterTool (com.test.event.configuration.JobConfiguration)
configuration (com.test.event.steps.PasswordChangedStep)
    at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125)
    at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:528)
    at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:679)
    at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:106)
    at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:528)
    at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:679)
    at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:106)
    at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:528)
    at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:761)
    at org.apache.flink.api.java.typeutils.runtime.kryo.KryoSerializer.deserialize(KryoSerializer.java:249)
    at org.apache.flink.contrib.streaming.state.RocksDBValueState.value(RocksDBValueState.java:83)
    at com.test.event.transform.StateProcessFunction.processElement(StateProcessFunction.java:39)
    at com.test.event.transform.StateProcessFunction.processElement(StateProcessFunction.java:1)
    at org.apache.flink.streaming.api.operators.KeyedProcessOperator.processElement(KeyedProcessOperator.java:94)
    at org.apache.flink.streaming.runtime.io.StreamInputProcessor.processInput(StreamInputProcessor.java:207)
    at org.apache.flink.streaming.runtime.tasks.OneInputStreamTask.run(OneInputStreamTask.java:69)
    at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:264)
    at org.apache.flink.runtime.taskmanager.Task.run(Task.java:718)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.UnsupportedOperationException
    at java.util.Collections$UnmodifiableMap.put(Collections.java:1457)
    at com.esotericsoftware.kryo.serializers.MapSerializer.read(MapSerializer.java:144)
    at com.esotericsoftware.kryo.serializers.MapSerializer.read(MapSerializer.java:21)
    at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:679)
    at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:106)
    ... 18 more

不知道这是什么意思。使用 process 函数 (https://ci.apache.org/projects/flink/flink-docs-release-1.5/dev/stream/operators/process_function.html) 时还有其他人遇到相同的行为吗?

原来是因为使用 ParameterTool 作为状态的一部分,我们把它去掉了,只保留了需要的配置部分(几个 int 值),现在它可以工作了