I was trying to store the below serialized custom java object using camunda Rest api( POST /process-definition/key/{key}/tenant-id/{tenant-id}/start
) requestBody (processvariables):
{
"variables": {
"serviceAuthToken": {
"value": "{\"apiKey\":\"key1\",\"token\":\"token\",\"currentTenant\":\"tenant1\",\"userId\":\"userId\"}",
"type": "Object",
"valueInfo": {
"objectTypeName": "com.camunda.dto.ServiceAuthToken",
"serializationDataFormat": "application/json"
}
}
}
}
Java Class:
@Getter
@Setter
@NoArgsConstructor
public class ServiceAuthToken implements Serializable {
private static final long serialVersionUID = 1L;
private String apiKey;
private String token;
private String currentTenant;
private String userId;
}
Exception:
[org.camunda.bpm.engine.context] [logError] @ 156 : ENGINE-16004 Exception while closing command context: Cannot find serializer for value 'ObjectValue [value=null, isDeserialized=false, serializationDataFormat=application/json, objectTypeName=com.camunda.dto.ServiceAuthToken, serializedValue=827 chars, isTransient=false]'.
org.camunda.bpm.engine.ProcessEngineException: Cannot find serializer for value 'ObjectValue [value=null, isDeserialized=false, serializationDataFormat=application/json, objectTypeName=com.camunda.dto.ServiceAuthToken, serializedValue=827 chars, isTransient=false]'.
at org.camunda.bpm.engine.impl.variable.serializer.DefaultVariableSerializers.findSerializerForValue(DefaultVariableSerializers.java:84)
at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.setValue(TypedValueField.java:110)
at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.<init>(VariableInstanceEntity.java:122)
at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.create(VariableInstanceEntity.java:141)
at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntityFactory.build(VariableInstanceEntityFactory.java:27)
Any suggestions to solve this problem?