Jackson cant serialize Camunda Objects

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?

Hi @langosSimp

These problems have recently started to occur. Previously it worked perfectly.

What changes were made before it started to occur?

Regards,
Alex

Hi @Alex_Voloshyn

Maybe my wording wasn´t ideal. I dont really know when the error started to occur. The error was documented on 27.08.24. No big related changes beforehand. The camunda version was updated on 17.07.24 from 7.20.0 to 7.21.0 tho. Is there a possibility that it is related to this update? Maybe some config conflicts?