gpt4 book ai didi

json - Spring Integration json 路径表达式转换错误

转载 作者:行者123 更新时间:2023-12-02 16:23:50 24 4
gpt4 key购买 nike

我的 spring 集成正在尝试转换来自输入 channel 的 JSON 消息,并通过提供相应的 key 从 JSON 消息中提取值。它抛出 SpelEvaluationException。

Spring集成配置

<int:object-to-json-transformer input-channel="inputEventChannel" output-channel="jsonMapChannel"/>

<int:transformer input-channel="jsonMapChannel" output-channel="transformChannel"
expression="#jsonPath(payload, '$.[0].EVENTNAME')"/>

错误消息

Caused by: org.springframework.messaging.MessageHandlingException: Expression evaluation failed: #jsonPath(payload, '$.[0].EVENTNAME'); nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1022E: The function 'jsonPath' mapped to an object of type 'class org.springframework.expression.TypedValue' which cannot be invoked, failedMessage=GenericMessage [payload=[{"EVENTID":5064015,"EVENTNAME":"Account","EVENTID":"15590","APPLICATIONID":1,"CREATEDTIMESTAMP":1493929367000,"TRANSACTIONID":"100.2.33"}], headers={json__ContentTypeId__=class org.springframework.util.LinkedCaseInsensitiveMap, id=acbc053a-b466-fbb9-8d3d-f60c78371b3e, json__TypeId__=class java.util.ArrayList, contentType=application/json, timestamp=1493933245720}]

我可以知道这里出了什么问题吗?我什至也尝试过这个。相同的错误行为。

#jsonPath(payload, '$.EVENTNAME')

谢谢。

最佳答案

EL1022E 表示 jsonPath 函数未注册为函数。

这意味着 JsonPath jar 不在类路径上。

DEBUG 日志记录应该显示此日志...

logger.debug("The '#jsonPath' SpEL function cannot be registered: " +
"there is no jayway json-path.jar on the classpath.");

关于json - Spring Integration json 路径表达式转换错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43808744/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com