3
votes

My spring integration is trying to transform JSON message from input channel and extract a value from JSON message by providing the corresponding key. Its throwing 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 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}]

May I know what went wrong here? I even tried with this too. Same error behavior.

#jsonPath(payload, '$.EVENTNAME')

Thanks.

1

1 Answers

2
votes

EL1022E means that the jsonPath function is not registered as a function.

Which means the JsonPath jar is not on the classpath.

DEBUG logging should show this log...

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