CachedDbEntity exception

Hello,

we have embedded the camunda engine in one of our applications. While it runs fine on the development machines we keep getting the following output when deploying the application:

[error] o.c.b.e.context - ENGINE-16004 Exception while closing command context: null
java.lang.NullPointerException: null
at org.camunda.bpm.engine.impl.db.entitymanager.cache.CachedDbEntity.isDirty(CachedDbEntity.java:53)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushCachedEntity(DbEntityManager.java:434)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushEntityCache(DbEntityManager.java:417)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:283)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:203)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:132)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:113)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.camunda.bpm.engine.impl.ManagementServiceImpl.setProperty(ManagementServiceImpl.java:161)

Any thoughts what could cause this error?

Thanks

Hello,

Is this the whole stack trace of the exception? And do you know how to reproduce the issue?

Best regards,
Yana

Hello Yana,

thanks a lot for your feedback! We were now able to reproduce and solve the problem.

Just for the record:

We are maintaining some email server configuration using the management service which is populated during startup (not sure if this is good practice).

engine.getManagementService().setProperty(name, value);

In some cases value is null which works fine in the first place (it gets populated in act_ge_properties) but it fails on update with the above error.

String name = "emailEncryption";
String value = null;
		
engine.getManagementService().setProperty(name, value);  // <-- works
log.info("Property was set");
		
engine.getManagementService().setProperty(name, value); // <-- error 
log.info("Property was updated"); 

Regards

f_a, how did you manage to resolve it?
i have the same problem when im using @PostConstruct annotation in the method that creates the properties.
When i remove the anotation, i can call engine.getManagementService().setProperty many times and there is no error.

It think the problem only occurred when updating an existing property to null and we ended up setting it to something like "none" for these cases.

that was it, i didn’t notice before but i tried to set null value. Thanks again.