External Task Error: ENGINE-17007 Java serialization format is prohibited

What I am trying to do: Complete an external task.
Sample:

variables: {
  "fund-classs": {
    "value": "[\"a\",\"b\",\"c\"]",
    "type": "Object",
    "valueInfo": { 
       objectTypeName: "java.util.ArrayList", serializationDataFormat: "application/x-java-serialized-object"
    }
  }
}

Which Throws:
500 - {"type":"ProcessEngineException","message":"ENGINE-17007 Cannot set variable with name data. Java serialization format is prohibited"}

Why is it stringified: (“["a","b","c"]”) : Endpoint POST /external-task/{id}/complete The variable’s value. For variables of type Object, the serialized value has to be submitted as a String value. as per the documentation.

Why I am trying to save the data with this format: The data while creation of the process was automatically created in this format, upon updation via external task, converts into JSON which is a type mismatch for further tasks in the flow.

Also, I am getting the same error via REST endpoint : process-instance/{id}/modification

Hi @vermauv,

you get this error because the Java object serialization is disabled by default. You should use Camunda Spin and set the serialization format to JSON or XML.

Best regards,
Philipp

Hi @Philipp_Ossler,

Thanks for the reply, This works <property name="javaSerializationFormatEnabled">true</property>

Hi Philipp
I am trying to create a process instance in my deployed Camunda Workflow having a process variable which has value as a Collection via REST API only (we are communicating with Camunda Engine only via REST APIs)
Tried various ways using Camunda Spin but it doesn’t work.
Here is the Request Body :
{
“variables”: {
“users” : {
“type”: “Object”,
“value”: “[“joe@b.com”,“lisa@b.com”,“pete@b.com”]”,
“valueInfo” : {“objectTypeName”: “java.util.HashSet”, “serializationDataFormat”: “application/json” } }
} ,
“businessKey” : “ms-modify-users”
}

The API :
/rest/process-definition/key/ms-modify-users/start

The Response Which I am getting from Camunda Engine :
{
“type”: “RestException”,
“message”: “Cannot instantiate process definition ms-modify-users:3:1142c7b6-c026-11e9-8f53-eeee0aff29ad: Cannot find serializer for value ‘ObjectValue [value=null, isDeserialized=false, serializationDataFormat=application/json, objectTypeName=java.util.HashSet, serializedValue=63 chars, isTransient=false]’.”
}

Is the Request body format correct for Collections?

I am guessing the solution here would have been to add the Camunda SPIN dependencies to the server. Those add the JSON support.

The original error discussed here can also occur if e.g. an external worker is submitting an update to a data with serialization application/json but the process variable has previously been stored with Java serialization (Cockpit showing application/x-java-serialized-object).