Spring Integration transformation error using json path expression
The my spring integration tries to transform the JSON message from the input channel and extract the value from the JSON message by providing the appropriate key. Its throwing a SpelEvaluationException.
Spring Integration Configuration
<int:object-to-json-transformer input-channel="inputEventChannel" output-channel="jsonMapChannel"/>
<int:transformer input-channel="jsonMapChannel" output-channel="transformChannel"
expression="#jsonPath(payload, '$.[0].EVENTNAME')"/>
Error message
Caused by: org.springframework.messaging.MessageHandlingException: Expression evaluation failed: #jsonPath (payload, $. [0] .EVENTNAME '); Nested Exception - org.springframework.expression.spel.SpelEvaluationException: EL1022E: jsonPath function mapped to object of type 'class org.springframework.expression.TypedValue' which cannot be called, 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}]
May I know what happened here? I even tried with that too. Same error behavior.
#jsonPath(payload, '$.EVENTNAME')
Thank.
source to share
EL1022E
means the function is jsonPath
not registered as a function.
This means the jar is jsonPath
not in the classpath.
The DEBUG log should show this log ...
logger.debug("The '#jsonPath' SpEL function cannot be registered: " +
"there is no jayway json-path.jar on the classpath.");
source to share