I have a SpringBoot application using embedded tomcat which has a Delegate method that is adding a process variable. Code snippet as below:
File xmlFile = new File(“XXXXXXXXXX.xml”);
OrderRequest orderReq = null;
JAXBContext jaxbContext;
try
{
jaxbContext = JAXBContext.newInstance(OrderRequest.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
orderReq = (OrderRequest) jaxbUnmarshaller.unmarshal(xmlFile);
System.out.println(orderReq);
}
catch (JAXBException e)
{
e.printStackTrace();
}
ObjectValue typedOrderReqValue = Variables.objectValue(orderReq).serializationDataFormat(SerializationDataFormats.XML).create();
execution.setVariable("ORDER-REQ", typedOrderReqValue);
execution.setVariable(“ORDER-REQ”, typedOrderReqValue);
This is resulting in below exception -
org.camunda.bpm.engine.ProcessEngineException: Cannot serialize object in variable ‘ORDER-REQ’: SPIN/DOM-XML-01030 Cannot create context
at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.writeValue(AbstractSerializableValueSerializer.java:57) ~[camunda-engine-7.11.0.jar:7.11.0]
at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.writeValue(AbstractSerializableValueSerializer.java:31) ~[camunda-engine-7.11.0.jar:7.11.0]
at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.writeValue(TypedValueField.java:163) ~[camunda-engine-7.11.0.jar:7.11.0]
at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.setValue(TypedValueField.java:123) ~[camunda-engine-7.11.0.jar:7.11.0]
at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.(VariableInstanceEntity.java:127) ~[camunda-engine-7.11.0.jar:7.11.0]
at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.create(VariableInstanceEntity.java:146) ~[camunda-engine-7.11.0.jar:7.11.0]
Could you please tell how to resolve this. This works when I try to set this process variable from a standalone application deployed in tomcat.