You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Oleksandr (Jira)" <ji...@apache.org> on 2022/05/27 12:29:00 UTC

[jira] [Commented] (FLINK-25197) Using Statefun RequestReplyFunctionBuilder fails with Java 8 date/time type `java.time.Duration` not supported by default: add Module "org.apache.flink.shaded.jackson2.com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling

    [ https://issues.apache.org/jira/browse/FLINK-25197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17542896#comment-17542896 ] 

Oleksandr commented on FLINK-25197:
-----------------------------------

Hi, [~galenwarren] could your fix affect this issue - https://issues.apache.org/jira/browse/FLINK-27813 ?

> Using Statefun RequestReplyFunctionBuilder fails with Java 8 date/time type `java.time.Duration` not supported by default: add Module "org.apache.flink.shaded.jackson2.com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling 
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-25197
>                 URL: https://issues.apache.org/jira/browse/FLINK-25197
>             Project: Flink
>          Issue Type: Bug
>          Components: Stateful Functions
>    Affects Versions: statefun-3.1.0
>            Reporter: Galen Warren
>            Assignee: Galen Warren
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: statefun-3.2.0, statefun-3.1.2
>
>
> When using RequestReplyFunctionBuilder to build a stateful functions job, the job fails at runtime with:
> Java 8 date/time type `java.time.Duration` not supported by default: add Module "org.apache.flink.shaded.jackson2.com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling 
> It appears this is because, in [RequestReplyFunctionBuilder::transportClientPropertiesAsObjectNode|https://github.com/apache/flink-statefun/blob/b4ba9547b8f0105a28544fd28a5e0433666e9023/statefun-flink/statefun-flink-datastream/src/main/java/org/apache/flink/statefun/flink/datastream/RequestReplyFunctionBuilder.java#L127], a default instance of ObjectMapper is used to serialize the client properties, which now include a java.time.Duration. There is a [StateFunObjectMapper|https://github.com/apache/flink-statefun/blob/master/statefun-flink/statefun-flink-common/src/main/java/org/apache/flink/statefun/flink/common/json/StateFunObjectMapper.java] class in the project that has customized serde support, but it is not used here.
> The fix seems to be to:
>  * Use an instance of StateFunObjectMapper to serialize the client properties in RequestReplyFunctionBuilder
>  * Modify StateFunObjectMapper to both serialize and deserialize instances of java.time.Duration (currently, only deserialization is supported)
> I've made these changes locally and it seems to fix the problem. Would you be interested in a PR? Thanks.
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)