添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I have a java object that is set as process variable, but it I get error when I try to deserialize it using REST API. Here is the error I get

“type”: “ProcessEngineException”,
“message”: "Cannot deserialize object in variable ‘ACTIVITY_TRACKER’: ENGINE-09017 Cannot load class.

the java class is as below. Both the parent and the dependent class implement java.io.Serializable
public class ActivityTracker implements java.io.Serializable {

   public static ArrayList<ActivityInfo> activityList = new ArrayList<ActivityInfo>();
	public void addActivityInfo(ActivityInfo activityInfo){
		this.activityList.add(activityInfo);
	public void removeActivityInfo(ActivityInfo activityInfo){
		this.activityList.remove(activityInfo);

I have tried to follow the document to use specific serializer as well when setting the variable.

ObjectValue activityTrackerDataValue = Variables.objectValue(activityTracker)
			  .serializationDataFormat(Variables.SerializationDataFormats.JAVA)
			  .create();
	delegateExecution.setVariable("ACTIVITY_TRACKER", activityTrackerDataValue );
              

Hi @adat,

The REST API cannot load the classes that are located in your process application. It is recommended to serialize such objects as JSON (i.e. serialization data format application/json) and then only fetch the serialized value via REST API by adding the query parameter deserializeValues=false.

Cheers,
Thorben

@thorben

I have the Java POJO object. How to mark that for Json serilalization in camunda?

Thanks @adat

To use it in REST API, set serializationDataFormat: "application/json" NOT serializationDataFormat: "JSON"

However, I’m still confused what to put in objectTypeName??? As the JSON object does not have a Java class definition.

UPDATE: Turns out this is very easy, just set e.g.

{"value": "{\"some\": \"JSON\"}", "type": "Json"}

Json is the magic undocumented type (as of 7.14).