We have a process that normally works as expected, but only when we have a huge load of process instances we see many incidents of this error:
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to …
This error happens because a variable, wich should be of a class type of ours, was saved as LinkedHashmap and we dont know why. So when another delegate tries to do a getVariable and cast it to our type it gives me this class cast exception.
Theres nothing fancy about how we save this variable, this is just:
variableScope.setVariable( “myVariableName”, myObject);
And the code that gives the classCastException is:
return (MyType) variableScope.getVariable(“myVariableName”);
Its weird because we have this process running 24/7, working normally, but only in times of huge load some instances save this as a linkedhashmap instead of the correct type.
I need to execute this update in database and then start a job retry by rest api to solve it everytime:
update ACT_RU_VARIABLE
set TEXT2_ = "com.company.MyType"
where NAME_ like "myVariableName"
AND TEXT2_ = "java.util.LinkedHashMap<java.lang.Object,java.lang.Object>";
We are using camunda springboot 7.13.0 with mysql 5.7 database in a clustered environment with multiple pods running this project.
We also have this dependencies in our build.gradle that maybe are related to this type serialization problem:
compile(“org.camunda.bpm:camunda-engine-plugin-spin:7.13.0”)
compile(“org.camunda.spin:camunda-spin-core:1.10.1”)
compile(“org.camunda.spin:camunda-spin-dataformat-json-jackson:1.10.1”)