I am working on a Camunda application using Jackson for JSON serialization. Recently I have been experiencing issues with serializing Camunda objects.
Details: Camunda Version: 7.21.0 Jackson Version: 2.16.0 Spring Framework Version: 5.3.32
Error description: Jackson serialization fails and I get the following error messages in my REST-Api:
org.springframework.http.converter.HttpMessageConversionException: type definition error: [simple type, class org.camunda.bpm.engine.impl.core.model.Properties]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.camunda.bpm.engine.impl.core.model. Properties and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: java. util.ArrayList[0]->en._______.api.core.rest.types.ReturnPlain[“content”]->java.util.ArrayList[0]->org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity[“properties”])
and
org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Cannot invoke “org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.isExecutionTreePrefetchEnabled()” because the return value of “org. camunda.bpm.engine.impl.context.Context.getProcessEngineConfiguration()” is null; nested exception is com.fasterxml.jackson.databind.JsonMappingException: The call of ”org.camunda.bpm. engine.impl.cfg.ProcessEngineConfigurationImpl.isExecutionTreePrefetchEnabled()” is not possible because the return value of ‘org.camunda.bpm.engine.impl.context.Context. getProcessEngineConfiguration()’ is null (via the reference chain: java. util.ArrayList[0]->en.________.api.core.rest.types.ReturnPlain[“content”]->java.util.ArrayList[0]->org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity[“businessKey”])
These problems have recently started to occur. Previously it worked perfectly.
Note: Is it possible that there is a problem when Jackson and Gson are used in the same project? I don’t really see any problems in the implementation, but Gson was introduced around the time the problems occurred. Maybe a coincidence, maybe not. Gson version: 2.9.0
I’ve already tried adjusting the Jackson mapper configuration (e.g., SerializationFeature.FAIL_ON_EMPTY_BEANS, FAIL_ON_UNKNOWN_PROPERTIES or setVisibility), but without success leading to a self-referencing loop.
What I’ve Tried: Changed the Jackson configuration. Reviewed the code for potential issues in the data models. Ensured that all required fields are accessible for serialization. Tried older versions.
So my question: Does anybody know, why Jackson cant serialize some Camunda-Objects?