Unsupported value type '*Json'*

While processing json type variables, camunda springboot standalone application is failing with exception Unsupported value type ‘Json’.

Steps to reproduce -

  • Create a simple process having single external Task step.
  • Start a process Instance.
  • FetchAndLock and complete through external task client.
  • In Complete I am sending variables like
  • {
    “workerId”: “Akku”,
    “variables”: {
    “additionalJsonInfoObject”: {
    “value”: { “project”: “test”, “region”: “test” },
    “type”: “Json”,
    “valueInfo”: {}
    }
    }
    }

And I am getting org.camunda.bpm.engine.rest.exception.RestException: Unsupported value type ‘Json’ exception.

I have added spin dependencies[camunda-engine-plugin-spin, camunda-spin-dataformat-json-jackson, with camunda-bom] in the project.

Camunda is standalone springboot project version - 7.12.0 with postgres.

Is there anything missing in configuration to start json as a primitve type.?

Thanks in Advance :slight_smile:

Json is not serialized

Do you want to say Json value need to be serialized before sending? Because I can see same type received camunda engine side. And as I have added spin dependency it should process out.
Can you please provide me some example or link for the same for more clarification.

Any help related to it.
As per documentation https://docs.camunda.org/manual/7.12/user-guide/process-engine/variables/#json-and-xml-values Camunda engine can accept json value.

The value field must contain an escaped String of the serialized variable value (XML or JSON depending on the serializationDataFormat field).

valueInfo A JSON object containing additional, value-type-dependent properties.

For serialized variables of type Object , the following properties can be provided:

  • objectTypeName : A string representation of the object’s type name.
  • serializationDataFormat : The serialization format used to store the variable.

Capture

Post call Engine/external-task/919db91d-32df-11ea-b2f7-00155db0010f/complete
Tried by defining the serialization format. But isn’t working.

2020-01-14 18:55:19.214 ERROR 21412 — [nio-6063-exec-1] org.camunda.bpm.engine.context : ENGINE-16004 Exception while closing command context: Cannot find serializer for value ‘ObjectValue [value=null, isDeserialized=false, serializationDataFormat=application/json, objectTypeName=org.camunda.spin.Spin.JSON, serializedValue=34 chars, isTransient=false]’.

org.camunda.bpm.engine.ProcessEngineException: Cannot find serializer for value ‘ObjectValue [value=null, isDeserialized=false, serializationDataFormat=application/json, objectTypeName=org.camunda.spin.Spin.JSON, serializedValue=34 chars, isTransient=false]’.

Hi @akkujain93,

recenetly I’ve created an example to show how to work with complex object variables in the external task client for java. Have a look at my branch here: https://github.com/ingorichtsmeier/camunda-external-task-client-java/tree/object-variables-example/examples/dataformat-example

Hope this helps, Ingo

I tried this test project with my camunda engine spring boot project but still with your customer data I am getting org.camunda.bpm.engine.rest.exception.RestException: Unsupported value type ‘Json’ Exception.
Am I missing some configuration? Attaching my configuration application.txt (1.3 KB)

¿did you try with postman the json format?

Yes I tried.
I posted the screenshot as well and faced the same issue.

Any suggestion or help regarding it?

Hi @akkujain93,

the correct payload in your case would probably be:

{
  "workerId": "Akku",
  "variables": {
    "additionalJsonInfoObject": {
      "value": "{ \"project\": \"test\", \"region\": \"test\" }",
      "type": "Json"
    }
  }
}

Your type should be Json and the value should be the serialized JSON.

This however only works if Spin is correctly configured with your Spring Boot application.
You mentioned that camunda-engine-plugin-spin and camunda-spin-dataformat-json-jackson are part of your application dependencies. The exception message you are receiving however rather points to Spin not being on your classpath and therefore not loaded in your application.

Maybe you can show a little bit more from your pom.xml?
It should explicitly contain both dependencies mentioned.

Best,
Tobias

2 Likes

pom.xml (5.4 KB)
Please refer my pom file.

I used your POM together with the sources from our official Spring Boot Camunda Webapps example and that works totally fine.

Any specific configuration we should know about (application.yml and configuration classes)?
Can you detect something like the following lines in your log?

INFO 8396 --- [main] org.camunda.spin : SPIN-01011 Discovered Spin data format configurator: class org.camunda.bpm.spring.boot.starter.spin.CamundaJacksonFormatConfiguratorJSR310[dataformat = org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat]
INFO 8396 --- [main] org.camunda.spin : SPIN-01011 Discovered Spin data format configurator: class org.camunda.bpm.spring.boot.starter.spin.CamundaJacksonFormatConfiguratorParameterNames[dataformat = org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat]
INFO 8396 --- [main] org.camunda.spin : SPIN-01011 Discovered Spin data format configurator: class org.camunda.bpm.spring.boot.starter.spin.CamundaJacksonFormatConfiguratorJdk8[dataformat = org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat]
INFO 8396 --- [main] org.camunda.spin : SPIN-01009 Discovered Spin data format: org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat[name = application/json]

It is not showing this logging in my case. When I add data-format dependency then it let me show spin logging .

I’m afraid you will have to provide a minimal project ZIP that reliably reproduces this problem, otherwise it is going to be hard to detect what is going wrong in your case here.


Kindly refer to my project.

I just deleted my repository. And created it again.
Now it’s picking up json with
{
“workerId”: “Akku”,
“variables”: {
“additionalJsonInfoObject”: {
“value”: “{ “project”: “test”, “region”: “test” }”,
“type”: “Json”
}
}
}
Seems library wasn’t getting added in classpath somehow.
Thanks everyone for your kind support.

1 Like

Glad it works now! :slight_smile: