Camunda 7.9.1-ee Cannot create TypeBindings for class groovy.json.internal.LazyMap

We have workflow and in that we do have some extensive json string creation and updates. The workflow was working fine with Camunda 7.7-ee and now we upgraded to 7.9.1-ee, the workflow fails with below error. I understand Jackson version has been updated from 2.6.3 to 2.9.5, but could not understand what the problem is. Any pointers would help. Thanks.

 2019-10-14 15:54:45,450 ERROR [org.camunda.bpm.engine.context] (job-executor-tp-threads - 462) ENGINE-16004 Exception while closing command context: Cannot deserialize object in variable 'hotParametersMap': SPIN/JACKSON-JSON-01007 Cannot construct java type from string 'groovy.json.internal.LazyMap<java.lang.String,java.lang.Object>': org.camunda.bpm.engine.ProcessEngineException: Cannot deserialize object in variable 'hotParametersMap': SPIN/JACKSON-JSON-01007 Cannot construct java type from string 'groovy.json.internal.LazyMap<java.lang.String,java.lang.Object>'
at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.readValue(AbstractSerializableValueSerializer.java:81) [camunda-engine-7.9.1-ee.jar:7.9.1-ee]
at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.readValue(AbstractSerializableValueSerializer.java:27) [camunda-engine-7.9.1-ee.jar:7.9.1-ee]
at org.camunda.bpm.engine.impl.persistence.entity.util.TypedValueField.getTypedValue(TypedValueField.java:93) [camunda-engine-7.9.1-ee.jar:7.9.1-ee]

	at org.jboss.threads.JBossThread.run(JBossThread.java:122)
    Caused by: org.camunda.spin.json.SpinJsonDataFormatException: SPIN/JACKSON-JSON-01007 Cannot construct java type from string 'groovy.json.internal.LazyMap<java.lang.String,java.lang.Object>'
at org.camunda.spin.impl.json.jackson.JacksonJsonLogger.unableToConstructJavaType(JacksonJsonLogger.java:71)
at org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat.constructJavaTypeFromCanonicalString(JacksonJsonDataFormat.java:163)
at org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatMapper.mapInternalToJava(JacksonJsonDataFormatMapper.java:66)
at org.camunda.spin.plugin.impl.SpinObjectValueSerializer.deserializeFromByteArray(SpinObjectValueSerializer.java:93)
at org.camunda.bpm.engine.impl.variable.serializer.AbstractObjectValueSerializer.deserializeFromByteArray(AbstractObjectValueSerializer.java:109) [camunda-engine-7.9.1-ee.jar:7.9.1-ee]
at org.camunda.bpm.engine.impl.variable.serializer.AbstractSerializableValueSerializer.readValue(AbstractSerializableValueSerializer.java:79) [camunda-engine-7.9.1-ee.jar:7.9.1-ee]
... 174 more
Caused by: java.lang.IllegalArgumentException: Cannot create TypeBindings for class groovy.json.internal.LazyMap with 2 type parameters: class expects 0
at com.fasterxml.jackson.databind.type.TypeBindings.create(TypeBindings.java:139)
at com.fasterxml.jackson.databind.type.TypeBindings.create(TypeBindings.java:98)
at com.fasterxml.jackson.databind.type.TypeBindings.create(TypeBindings.java:87)
at com.fasterxml.jackson.databind.type.TypeParser.parseType(TypeParser.java:54)
at com.fasterxml.jackson.databind.type.TypeParser.parse(TypeParser.java:33)
at com.fasterxml.jackson.databind.type.TypeFactory.constructFromCanonical(TypeFactory.java:534)
at org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat.constructJavaTypeFromCanonicalString(JacksonJsonDataFormat.java:161)
... 178 more

Hi @bpmlearner,

From the exception, it seems like you don’t have the necessary DataFormat to serialize/deserialize the type or it’s possible that you’re missing a Jackson module that is necessary to deserialize this object. Have you checked the following docs?

https://docs.camunda.org/manual/latest/reference/spin/extending-spin/#configuring-data-formats

Best,
Nikola

No, formats are found and many JSON processing is done before getting this failure.

The other thing what i noticed here is, that the workflow tries to start a call activity and that is where it fails (start event of this call activity is asyncafter true). Since the workflow failed, it goes to be previous commit point and starts. while starting the execution variables are read from DB and that is when deserialization happens. but this particular variable was set to “null” before the commit point. I could not figure out why it fails at the start of the call activity. (this was working fine in the previous version of camunda i.e. 7.7)

Any pointers?

I’m not sure what exactly the problem is. Can you provide an example project that reproduces the issue, so that I can replicate it locally?

Best,
Nikola

Even I could not replicate it locally with simple workflows.
A variable which is of type map (created in groovy scripts) is persisted in execution as execution variable and before going to timer, this is set to null as this may have some huge data to avoid persist error (in data size). After this a wait timer has been executed few times and moves on to the next call activity which is having aysncAfter true at the start event. Hence aysnctrue, the process engine persists all the execution variables into db and starts. but the call activity could not start due to deserialization error (Cannot deserialize object in variable)

The cause for this issue is Jackson version 2.9.5 which is bundled in Camuda 7.9. Jackson 2.6.3 in Camunda 7.7 works fine.
Jackson 2.9.5 added restriction when trying to build TypeBindings for the type LazyMap.

def hotLazyMap = new JsonSlurper().parseText('{ "List": [4, 8, 15, 16, 23, 42] }')
println hotLazyMap instanceof Map ; //true
println hotLazyMap instanceof LazyMap; //true
println hotLazyMap instanceof HashMap; //false

if (hotLazyMap.getClass() == Map.class)
    println "hotLazyMap is Map class";
else if (hotLazyMap.getClass() == LazyMap.class)
    println "hotLazyMap is LazyMap class" //prints this
else if (hotLazyMap.getClass() == HashMap.class)
    println "hotLazyMap is HashMap class"
else 
    println "hotLazyMap is Not in Map"    

println ("LazyMap.class.getTypeParameters().length: " + LazyMap.class.getTypeParameters().length) ; //0
println ("Map.class.getTypeParameters().length: " + Map.class.getTypeParameters().length); //2

When the parameter “hotLazyMap” persisted in DB and read again with Jackson2.9.5, the error ( Cannot create TypeBindings for class groovy.json.internal.LazyMap with 2 type parameters: class expects 0) is thrown ; same thing works fine in 2.6.3

Seems like only option is to downgrade the Jackson version to 2.6.3