REST service task for Fuse rest endpoint fails with com.fasterxml.jackson.core.JsonParseException

Solution Verified - Updated -

Issue

Data Inputs and Assignments of REST service task for Fuse rest endpoint is configured like the following:

Name        Data Type   Source  
Method      String      "POST"
Url     String      "http://localhost:8180/api/sample/demo"
ContentData String      businessId                             <--
ContentType String      "application/json"
ContentTypeCharset  String  "utf-8"
ResultClass String 
AcceptCharset   String
AcceptHeader    String
AuthType    String
AuthUrl     String
ConnectTimeout  String
HandleResponseErrors    String
Headers     String
Password    String
ReadTimeout String
Username    String

i.e. String type process variable businessId is assigned to ContentData.
If some string value is set to this process variable, this REST service task fails with exception like the following:

org.jbpm.process.workitem.rest.RESTWorkItemHandler  : Unsuccessful response from REST server (status: 500, endpoint: http://localhost:8180/api/sample/demo, response: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'test': was expecting 'null', 'true', 'false' or NaN
 at [Source: (ByteArrayInputStream); line: 1, column: 9]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:703)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:3532)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:3508)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._matchToken2(UTF8StreamJsonParser.java:2843)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._matchTrue(UTF8StreamJsonParser.java:2777)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:807)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:729)
    at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4142)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3071)
    at org.apache.camel.component.jackson.JacksonDataFormat.unmarshal(JacksonDataFormat.java:194)
    at org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:69)
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
    at org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:54)
    at org.apache.camel.processor.RestBindingAdvice.unmarshal(RestBindingAdvice.java:301)
    at org.apache.camel.processor.RestBindingAdvice.before(RestBindingAdvice.java:141)
    at org.apache.camel.processor.RestBindingAdvice.before(RestBindingAdvice.java:51)
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:149)
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
    at org.apache.camel.http.common.CamelServlet.doService(CamelServlet.java:213)
    at org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:79)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:584)
        ...

Why does it fail and how to avoid it?

Environment

  • Red Hat Process Automation Manager 7.5.1
  • Red Hat Fuse 7.8 on SpringBoot

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content