camunda-community-hub / micronaut-camunda-platform-7

Integration between Micronaut and Camunda (Workflow Engine). We configure Camunda with sensible defaults, so that you can get started with minimum configuration: simply add a dependency in your Micronaut project to embed the workflow engine!
https://camunda.com/blog/2021/07/automate-any-process-on-micronaut/
Apache License 2.0
75 stars 31 forks source link

Enabling history cleanup on empty db fails Camunda startup #410

Closed datakurre closed 2 years ago

datakurre commented 2 years ago

Not sure if this is because of Camunda or Micronaut Camunda, but when I configure history cleanup with batch window start time, Camunda startup fails with the stack trace below.

If I start Camunda once without history cleanup window batch window start time first, I can enable the setting and everything works as expected.

camunda:
  generic-properties:
    properties:
      history-cleanup-batch-window-start-time: "22:00"
org.camunda.bpm.engine.ProcessEngineException: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
        at org.camunda.bpm.engine.impl.util.ExceptionUtil.wrapPersistenceException(ExceptionUtil.java:263)
        at org.camunda.bpm.engine.impl.util.ExceptionUtil.doWithExceptionWrapper(ExceptionUtil.java:257)
        at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.selectById(DbSqlSession.java:120)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.selectById(DbEntityManager.java:211)
        at org.camunda.bpm.engine.impl.persistence.entity.PropertyManager.findPropertyById(PropertyManager.java:29)
        at org.camunda.bpm.engine.impl.cmd.GetNextIdBlockCmd.execute(GetNextIdBlockCmd.java:40)
        at org.camunda.bpm.engine.impl.cmd.GetNextIdBlockCmd.execute(GetNextIdBlockCmd.java:28)
        at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.lambda$execute$0(MnTransactionInterceptor.java:44)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.execute(AbstractSynchronousTransactionManager.java:142)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.execute(MnTransactionInterceptor.java:44)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
        at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.camunda.bpm.engine.impl.db.DbIdGenerator.getNewBlock(DbIdGenerator.java:49)
        at org.camunda.bpm.engine.impl.db.DbIdGenerator.getNextId(DbIdGenerator.java:41)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.ensureHasId(DbEntityManager.java:643)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.insert(DbEntityManager.java:525)
        at org.camunda.bpm.engine.impl.persistence.entity.JobManager.insertJob(JobManager.java:80)
        at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.insert(JobEntity.java:165)
        at org.camunda.bpm.engine.impl.persistence.entity.JobManager.insertAndHintJobExecutor(JobManager.java:98)
        at org.camunda.bpm.engine.impl.cmd.HistoryCleanupCmd.createJobs(HistoryCleanupCmd.java:137)
        at org.camunda.bpm.engine.impl.cmd.HistoryCleanupCmd.execute(HistoryCleanupCmd.java:85)
        at org.camunda.bpm.engine.impl.cmd.HistoryCleanupCmd.execute(HistoryCleanupCmd.java:48)
        at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.lambda$execute$0(MnTransactionInterceptor.java:44)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.execute(AbstractSynchronousTransactionManager.java:142)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.execute(MnTransactionInterceptor.java:44)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
        at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.camunda.bpm.engine.impl.HistoryServiceImpl.cleanUpHistoryAsync(HistoryServiceImpl.java:170)
        at org.camunda.bpm.engine.impl.HistoryServiceImpl.cleanUpHistoryAsync(HistoryServiceImpl.java:166)
        at org.camunda.bpm.engine.impl.BootstrapEngineCommand.createHistoryCleanupJob(BootstrapEngineCommand.java:85)
        at org.camunda.bpm.engine.impl.BootstrapEngineCommand.execute(BootstrapEngineCommand.java:57)
        at org.camunda.bpm.engine.impl.BootstrapEngineCommand.execute(BootstrapEngineCommand.java:41)
        at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.lambda$execute$0(MnTransactionInterceptor.java:44)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.execute(AbstractSynchronousTransactionManager.java:142)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.execute(MnTransactionInterceptor.java:44)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
        at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.camunda.bpm.engine.impl.ProcessEngineImpl.executeSchemaOperations(ProcessEngineImpl.java:151)
        at org.camunda.bpm.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:110)
        at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:1017)
        at info.novatec.micronaut.camunda.bpm.feature.ProcessEngineFactory.lambda$processEngine$0(ProcessEngineFactory.java:54)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.executeWrite(AbstractSynchronousTransactionManager.java:182)
        at info.novatec.micronaut.camunda.bpm.feature.ProcessEngineFactory.processEngine(ProcessEngineFactory.java:53)
        at info.novatec.micronaut.camunda.bpm.feature.$ProcessEngineFactory$ProcessEngine0$Definition.build(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2336)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:3281)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:3267)
        at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2820)
        at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2782)
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1638)
        at io.micronaut.inject.provider.BeanProviderDefinition$1.get(BeanProviderDefinition.java:68)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.InitProcessEngineService.onEvent(InitProcessEngineService.java:66)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.$InitProcessEngineService$Definition$Exec.dispatch(Unknown Source)
        at io.micronaut.context.AbstractExecutableMethodsDefinition$DispatchedExecutableMethod.invoke(AbstractExecutableMethodsDefinition.java:378)
        at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:4027)
        at io.micronaut.aop.chain.AdapterIntroduction.intercept(AdapterIntroduction.java:83)
        at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.InitProcessEngineService$ApplicationEventListener$onEvent1$Intercepted.onApplicationEvent(Unknown Source)
        at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:262)
        at io.micronaut.context.event.ApplicationEventPublisherFactory.access$200(ApplicationEventPublisherFactory.java:60)
        at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:229)
        at io.micronaut.context.DefaultBeanContext.publishEvent(DefaultBeanContext.java:1733)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:80)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:34)
        at io.micronaut.runtime.Micronaut.lambda$start$2(Micronaut.java:78)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at io.micronaut.runtime.Micronaut.start(Micronaut.java:76)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:320)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:306)
        at com.example.camunda.Application.main(Application.java:8)
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.postgresql.util.PSQLException: ERROR: relation "act_ge_property" does not exist
  Position: 15
### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/Property.xml
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity.selectProperty-Inline
### The error occurred while setting parameters
### SQL: select * from ACT_GE_PROPERTY where NAME_ = ?
### Cause: org.postgresql.util.PSQLException: ERROR: relation "act_ge_property" does not exist
  Position: 15
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)
        at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.lambda$selectById$2(DbSqlSession.java:120)
        at org.camunda.bpm.engine.impl.util.ExceptionUtil.doWithExceptionWrapper(ExceptionUtil.java:254)
        ... 77 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: relation "act_ge_property" does not exist
  Position: 15
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:354)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:484)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:404)
        at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:162)
        at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:151)
        at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
        at org.apache.ibatis.executor.BatchExecutor.doQuery(BatchExecutor.java:92)
        at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
        at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
        at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
        ... 81 common frames omitted
20:21:58.376 [main] ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
org.camunda.bpm.engine.ProcessEngineException: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
        at org.camunda.bpm.engine.impl.util.ExceptionUtil.wrapPersistenceException(ExceptionUtil.java:263)
        at org.camunda.bpm.engine.impl.util.ExceptionUtil.doWithExceptionWrapper(ExceptionUtil.java:257)
        at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.selectById(DbSqlSession.java:120)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.selectById(DbEntityManager.java:211)
        at org.camunda.bpm.engine.impl.persistence.entity.PropertyManager.findPropertyById(PropertyManager.java:29)
        at org.camunda.bpm.engine.impl.cmd.GetNextIdBlockCmd.execute(GetNextIdBlockCmd.java:40)
        at org.camunda.bpm.engine.impl.cmd.GetNextIdBlockCmd.execute(GetNextIdBlockCmd.java:28)
        at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.lambda$execute$0(MnTransactionInterceptor.java:44)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.execute(AbstractSynchronousTransactionManager.java:142)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.execute(MnTransactionInterceptor.java:44)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
        at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.camunda.bpm.engine.impl.db.DbIdGenerator.getNewBlock(DbIdGenerator.java:49)
        at org.camunda.bpm.engine.impl.db.DbIdGenerator.getNextId(DbIdGenerator.java:41)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.ensureHasId(DbEntityManager.java:643)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.insert(DbEntityManager.java:525)
        at org.camunda.bpm.engine.impl.persistence.entity.JobManager.insertJob(JobManager.java:80)
        at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.insert(JobEntity.java:165)
        at org.camunda.bpm.engine.impl.persistence.entity.JobManager.insertAndHintJobExecutor(JobManager.java:98)
        at org.camunda.bpm.engine.impl.cmd.HistoryCleanupCmd.createJobs(HistoryCleanupCmd.java:137)
        at org.camunda.bpm.engine.impl.cmd.HistoryCleanupCmd.execute(HistoryCleanupCmd.java:85)
        at org.camunda.bpm.engine.impl.cmd.HistoryCleanupCmd.execute(HistoryCleanupCmd.java:48)
        at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.lambda$execute$0(MnTransactionInterceptor.java:44)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.execute(AbstractSynchronousTransactionManager.java:142)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.execute(MnTransactionInterceptor.java:44)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
        at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.camunda.bpm.engine.impl.HistoryServiceImpl.cleanUpHistoryAsync(HistoryServiceImpl.java:170)
        at org.camunda.bpm.engine.impl.HistoryServiceImpl.cleanUpHistoryAsync(HistoryServiceImpl.java:166)
        at org.camunda.bpm.engine.impl.BootstrapEngineCommand.createHistoryCleanupJob(BootstrapEngineCommand.java:85)
        at org.camunda.bpm.engine.impl.BootstrapEngineCommand.execute(BootstrapEngineCommand.java:57)
        at org.camunda.bpm.engine.impl.BootstrapEngineCommand.execute(BootstrapEngineCommand.java:41)
        at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.lambda$execute$0(MnTransactionInterceptor.java:44)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.execute(AbstractSynchronousTransactionManager.java:142)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.execute(MnTransactionInterceptor.java:44)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
        at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.camunda.bpm.engine.impl.ProcessEngineImpl.executeSchemaOperations(ProcessEngineImpl.java:151)
        at org.camunda.bpm.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:110)
        at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:1017)
        at info.novatec.micronaut.camunda.bpm.feature.ProcessEngineFactory.lambda$processEngine$0(ProcessEngineFactory.java:54)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.executeWrite(AbstractSynchronousTransactionManager.java:182)
        at info.novatec.micronaut.camunda.bpm.feature.ProcessEngineFactory.processEngine(ProcessEngineFactory.java:53)
        at info.novatec.micronaut.camunda.bpm.feature.$ProcessEngineFactory$ProcessEngine0$Definition.build(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2336)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:3281)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:3267)
        at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2820)
        at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2782)
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1638)
        at io.micronaut.inject.provider.BeanProviderDefinition$1.get(BeanProviderDefinition.java:68)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.InitProcessEngineService.onEvent(InitProcessEngineService.java:66)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.$InitProcessEngineService$Definition$Exec.dispatch(Unknown Source)
        at io.micronaut.context.AbstractExecutableMethodsDefinition$DispatchedExecutableMethod.invoke(AbstractExecutableMethodsDefinition.java:378)
        at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:4027)
        at io.micronaut.aop.chain.AdapterIntroduction.intercept(AdapterIntroduction.java:83)
        at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.InitProcessEngineService$ApplicationEventListener$onEvent1$Intercepted.onApplicationEvent(Unknown Source)
        at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:262)
        at io.micronaut.context.event.ApplicationEventPublisherFactory.access$200(ApplicationEventPublisherFactory.java:60)
        at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:229)
        at io.micronaut.context.DefaultBeanContext.publishEvent(DefaultBeanContext.java:1733)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:80)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:34)
        at io.micronaut.runtime.Micronaut.lambda$start$2(Micronaut.java:78)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at io.micronaut.runtime.Micronaut.start(Micronaut.java:76)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:320)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:306)
        at com.example.camunda.Application.main(Application.java:8)
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.postgresql.util.PSQLException: ERROR: relation "act_ge_property" does not exist
  Position: 15
### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/Property.xml
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity.selectProperty-Inline
### The error occurred while setting parameters
### SQL: select * from ACT_GE_PROPERTY where NAME_ = ?
### Cause: org.postgresql.util.PSQLException: ERROR: relation "act_ge_property" does not exist
  Position: 15
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)
        at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.lambda$selectById$2(DbSqlSession.java:120)
        at org.camunda.bpm.engine.impl.util.ExceptionUtil.doWithExceptionWrapper(ExceptionUtil.java:254)
        ... 77 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: relation "act_ge_property" does not exist
  Position: 15
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:354)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:484)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:404)
        at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:162)
        at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:151)
        at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
        at org.apache.ibatis.executor.BatchExecutor.doQuery(BatchExecutor.java:92)
        at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
        at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
        at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
        ... 81 common frames omitted
20:21:58.401 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Error starting HTTP server: Error instantiating bean of type  [org.camunda.bpm.engine.ProcessEngine]

Message: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
Path Taken: ProcessEngine.processEngine(ProcessEngineConfiguration processEngineConfiguration,CamundaVersion camundaVersion,SynchronousTransactionManager transactionManager,BasicJdbcConfiguration basicJdbcConfiguration,ParallelInitializationService parallelInitializationService)
io.micronaut.http.server.exceptions.HttpServerException: Error starting HTTP server: Error instantiating bean of type  [org.camunda.bpm.engine.ProcessEngine]

Message: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
Path Taken: ProcessEngine.processEngine(ProcessEngineConfiguration processEngineConfiguration,CamundaVersion camundaVersion,SynchronousTransactionManager transactionManager,BasicJdbcConfiguration basicJdbcConfiguration,ParallelInitializationService parallelInitializationService)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:92)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:34)
        at io.micronaut.runtime.Micronaut.lambda$start$2(Micronaut.java:78)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at io.micronaut.runtime.Micronaut.start(Micronaut.java:76)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:320)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:306)
        at com.example.camunda.Application.main(Application.java:8)
Caused by: io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type  [org.camunda.bpm.engine.ProcessEngine]

Message: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
Path Taken: ProcessEngine.processEngine(ProcessEngineConfiguration processEngineConfiguration,CamundaVersion camundaVersion,SynchronousTransactionManager transactionManager,BasicJdbcConfiguration basicJdbcConfiguration,ParallelInitializationService parallelInitializationService)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2363)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:3281)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:3267)
        at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2820)
        at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2782)
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1638)
        at io.micronaut.inject.provider.BeanProviderDefinition$1.get(BeanProviderDefinition.java:68)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.InitProcessEngineService.onEvent(InitProcessEngineService.java:66)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.$InitProcessEngineService$Definition$Exec.dispatch(Unknown Source)
        at io.micronaut.context.AbstractExecutableMethodsDefinition$DispatchedExecutableMethod.invoke(AbstractExecutableMethodsDefinition.java:378)
        at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:4027)
        at io.micronaut.aop.chain.AdapterIntroduction.intercept(AdapterIntroduction.java:83)
        at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.InitProcessEngineService$ApplicationEventListener$onEvent1$Intercepted.onApplicationEvent(Unknown Source)
        at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:262)
        at io.micronaut.context.event.ApplicationEventPublisherFactory.access$200(ApplicationEventPublisherFactory.java:60)
        at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:229)
        at io.micronaut.context.DefaultBeanContext.publishEvent(DefaultBeanContext.java:1733)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:80)
        ... 7 common frames omitted
Caused by: org.camunda.bpm.engine.ProcessEngineException: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
        at org.camunda.bpm.engine.impl.util.ExceptionUtil.wrapPersistenceException(ExceptionUtil.java:263)
        at org.camunda.bpm.engine.impl.util.ExceptionUtil.doWithExceptionWrapper(ExceptionUtil.java:257)
        at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.selectById(DbSqlSession.java:120)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.selectById(DbEntityManager.java:211)
        at org.camunda.bpm.engine.impl.persistence.entity.PropertyManager.findPropertyById(PropertyManager.java:29)
        at org.camunda.bpm.engine.impl.cmd.GetNextIdBlockCmd.execute(GetNextIdBlockCmd.java:40)
        at org.camunda.bpm.engine.impl.cmd.GetNextIdBlockCmd.execute(GetNextIdBlockCmd.java:28)
        at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.lambda$execute$0(MnTransactionInterceptor.java:44)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.execute(AbstractSynchronousTransactionManager.java:142)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.execute(MnTransactionInterceptor.java:44)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
        at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.camunda.bpm.engine.impl.db.DbIdGenerator.getNewBlock(DbIdGenerator.java:49)
        at org.camunda.bpm.engine.impl.db.DbIdGenerator.getNextId(DbIdGenerator.java:41)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.ensureHasId(DbEntityManager.java:643)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.insert(DbEntityManager.java:525)
        at org.camunda.bpm.engine.impl.persistence.entity.JobManager.insertJob(JobManager.java:80)
        at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.insert(JobEntity.java:165)
        at org.camunda.bpm.engine.impl.persistence.entity.JobManager.insertAndHintJobExecutor(JobManager.java:98)
        at org.camunda.bpm.engine.impl.cmd.HistoryCleanupCmd.createJobs(HistoryCleanupCmd.java:137)
        at org.camunda.bpm.engine.impl.cmd.HistoryCleanupCmd.execute(HistoryCleanupCmd.java:85)
        at org.camunda.bpm.engine.impl.cmd.HistoryCleanupCmd.execute(HistoryCleanupCmd.java:48)
        at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.lambda$execute$0(MnTransactionInterceptor.java:44)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.execute(AbstractSynchronousTransactionManager.java:142)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.execute(MnTransactionInterceptor.java:44)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
        at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.camunda.bpm.engine.impl.HistoryServiceImpl.cleanUpHistoryAsync(HistoryServiceImpl.java:170)
        at org.camunda.bpm.engine.impl.HistoryServiceImpl.cleanUpHistoryAsync(HistoryServiceImpl.java:166)
        at org.camunda.bpm.engine.impl.BootstrapEngineCommand.createHistoryCleanupJob(BootstrapEngineCommand.java:85)
        at org.camunda.bpm.engine.impl.BootstrapEngineCommand.execute(BootstrapEngineCommand.java:57)
        at org.camunda.bpm.engine.impl.BootstrapEngineCommand.execute(BootstrapEngineCommand.java:41)
        at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.lambda$execute$0(MnTransactionInterceptor.java:44)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.execute(AbstractSynchronousTransactionManager.java:142)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.execute(MnTransactionInterceptor.java:44)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
        at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.camunda.bpm.engine.impl.ProcessEngineImpl.executeSchemaOperations(ProcessEngineImpl.java:151)
        at org.camunda.bpm.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:110)
        at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:1017)
        at info.novatec.micronaut.camunda.bpm.feature.ProcessEngineFactory.lambda$processEngine$0(ProcessEngineFactory.java:54)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.executeWrite(AbstractSynchronousTransactionManager.java:182)
        at info.novatec.micronaut.camunda.bpm.feature.ProcessEngineFactory.processEngine(ProcessEngineFactory.java:53)
        at info.novatec.micronaut.camunda.bpm.feature.$ProcessEngineFactory$ProcessEngine0$Definition.build(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2336)
        ... 25 common frames omitted
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.postgresql.util.PSQLException: ERROR: relation "act_ge_property" does not exist
  Position: 15
### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/Property.xml
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.PropertyEntity.selectProperty-Inline
### The error occurred while setting parameters
### SQL: select * from ACT_GE_PROPERTY where NAME_ = ?
### Cause: org.postgresql.util.PSQLException: ERROR: relation "act_ge_property" does not exist
  Position: 15
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)
        at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.lambda$selectById$2(DbSqlSession.java:120)
        at org.camunda.bpm.engine.impl.util.ExceptionUtil.doWithExceptionWrapper(ExceptionUtil.java:254)
        ... 77 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: relation "act_ge_property" does not exist
  Position: 15
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:354)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:484)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:404)
        at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:162)
        at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:151)
        at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
        at org.apache.ibatis.executor.BatchExecutor.doQuery(BatchExecutor.java:92)
        at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
        at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
        at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
        ... 81 common frames omitted
tobiasschaefer commented 2 years ago

Hi @datakurre,

thanks for creating the bug report - seems we optimized the start too much and some tables are loaded too late during startup ;-)

However, I cannot reproduce the issue by setting the property on my example application. Do you have a minimal example application to reproduce the issue?

Tobias

datakurre commented 2 years ago

Thanks already!

demo.tar.gz

I created that with https://micronaut.io/launch with only Camunda and postgres features, configured postgres and added the lines below to application.yml.

For me it is enough to start postgres with provided docker compose docker-compose up and then Camunda with ./mvnw mn:run to reproduce. Disabling history cleanup will allow Camunda to start.

camunda:                                                                                
  generic-properties:                                                                   
    properties:                                                                         
      history-cleanup-enabled: true                                                     
      history-cleanup-batch-window-start-time: "22:00" 
tobiasschaefer commented 2 years ago

Thanks @datakurre. I can reproduce the issue now.

Actually, the issue is only reproducible with postgres and not with h2.

We don't have any specific h2 or postgres related code in the Micronaut Camunda Integration. My first guess that it is related to the optimized startup has now proven wrong because I can also reproduce it with previous versions (which didn't include the startup).

Unfortunately, I cannot reproduce it with the Spring Boot Starter. I guess it will take some time to analyze this in detail.

tobiasschaefer commented 2 years ago

Hi @datakurre ,

I've released 2.7.2 minutes ago to Maven Central.

Please check and report back if it fixes your issue. Thanks :-)

datakurre commented 2 years ago

Unfortunately, not completely.

I'm unable to test with postgres right now (I don't want to install Docker on my Steam Deck), but this is the error, I get with H2 on a project. I'll provide updated minimal examples next week.

11:47:18.804 [main] INFO  org.camunda.feel.FeelEngine - Engine created. [value-mapper: CompositeValueMapper(List(org.camunda.feel.impl.JavaValueMapper@3178219a, org.camunda.spin.plugin.impl.feel.integration.SpinValueMapper@2d85fb64)), function-provider: org.camunda.bpm.dmn.feel.impl.scala.function.CustomFunctionTransformer@2f14b0f6, clock: SystemClock, configuration: Configuration(false)]
11:47:19.969 [main] WARN  org.camunda.bpm.engine - ENGINE-00009 Could not determine local IP address for generating a host name
java.net.UnknownHostException: steamdeck: steamdeck: Name or service not known
        at java.base/java.net.InetAddress.getLocalHost(InetAddress.java:1647)
        at org.camunda.bpm.engine.impl.history.event.SimpleIpBasedProvider.getHostname(SimpleIpBasedProvider.java:36)
        at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.initHostName(ProcessEngineConfigurationImpl.java:2411)
        at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:1075)
        at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:1016)
        at info.novatec.micronaut.camunda.bpm.feature.ProcessEngineFactory.lambda$processEngine$0(ProcessEngineFactory.java:54)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.executeWrite(AbstractSynchronousTransactionManager.java:182)
        at info.novatec.micronaut.camunda.bpm.feature.ProcessEngineFactory.processEngine(ProcessEngineFactory.java:53)
        at com.example.camunda.Engine.processEngine(Engine.java:44)
        at info.novatec.micronaut.camunda.bpm.feature.$ProcessEngineFactory$ProcessEngine0$Definition.build(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2336)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:3281)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:3267)
        at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2820)
        at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2782)
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1638)
        at io.micronaut.inject.provider.BeanProviderDefinition$1.get(BeanProviderDefinition.java:68)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.InitProcessEngineService.onEvent(InitProcessEngineService.java:66)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.$InitProcessEngineService$Definition$Exec.dispatch(Unknown Source)
        at io.micronaut.context.AbstractExecutableMethodsDefinition$DispatchedExecutableMethod.invoke(AbstractExecutableMethodsDefinition.java:378)
        at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:4027)
        at io.micronaut.aop.chain.AdapterIntroduction.intercept(AdapterIntroduction.java:83)
        at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.InitProcessEngineService$ApplicationEventListener$onEvent1$Intercepted.onApplicationEvent(Unknown Source)
        at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:262)
        at io.micronaut.context.event.ApplicationEventPublisherFactory.access$200(ApplicationEventPublisherFactory.java:60)
        at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:229)
        at io.micronaut.context.DefaultBeanContext.publishEvent(DefaultBeanContext.java:1733)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:80)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:34)
        at io.micronaut.runtime.Micronaut.lambda$start$2(Micronaut.java:78)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at io.micronaut.runtime.Micronaut.start(Micronaut.java:76)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:320)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:306)
        at com.example.camunda.Application.main(Application.java:8)
Caused by: java.net.UnknownHostException: steamdeck: Name or service not known
        at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
        at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:933)
        at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1519)
        at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:852)
        at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1509)
        at java.base/java.net.InetAddress.getLocalHost(InetAddress.java:1642)
        ... 35 common frames omitted
11:47:20.274 [main] INFO  org.camunda.bpm.engine.persistence - ENGINE-03016 Performing database operation 'create' on component 'engine' with resource 'org/camunda/bpm/engine/db/create/activiti.h2.create.engine.sql'
11:47:20.349 [main] INFO  org.camunda.bpm.engine.persistence - ENGINE-03016 Performing database operation 'create' on component 'history' with resource 'org/camunda/bpm/engine/db/create/activiti.h2.create.history.sql'
11:47:20.375 [main] INFO  org.camunda.bpm.engine.persistence - ENGINE-03016 Performing database operation 'create' on component 'identity' with resource 'org/camunda/bpm/engine/db/create/activiti.h2.create.identity.sql'
11:47:20.391 [main] INFO  org.camunda.bpm.engine.persistence - ENGINE-03016 Performing database operation 'create' on component 'decision.engine' with resource 'org/camunda/bpm/engine/db/create/activiti.h2.create.decision.engine.sql'
11:47:20.408 [main] INFO  org.camunda.bpm.engine.persistence - ENGINE-03016 Performing database operation 'create' on component 'decision.history' with resource 'org/camunda/bpm/engine/db/create/activiti.h2.create.decision.history.sql'
11:47:20.442 [main] INFO  org.camunda.bpm.engine.persistence - ENGINE-03067 No history level property found in database
11:47:20.443 [main] INFO  org.camunda.bpm.engine.persistence - ENGINE-03065 Creating historyLevel property in database for level: HistoryLevelFull(name=full, id=3)
11:47:20.582 [main] ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
org.camunda.bpm.engine.ProcessEngineException: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
        at org.camunda.bpm.engine.impl.util.ExceptionUtil.wrapPersistenceException(ExceptionUtil.java:263)
        at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.flushDbOperationUnexpectedException(EnginePersistenceLogger.java:680)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:344)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:323)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:295)
        at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:272)
        at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:188)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:119)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.lambda$execute$0(MnTransactionInterceptor.java:44)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.execute(AbstractSynchronousTransactionManager.java:142)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.execute(MnTransactionInterceptor.java:44)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
        at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.camunda.bpm.engine.impl.ProcessEngineImpl.executeSchemaOperations(ProcessEngineImpl.java:151)
        at org.camunda.bpm.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:110)
        at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:1017)
        at info.novatec.micronaut.camunda.bpm.feature.ProcessEngineFactory.lambda$processEngine$0(ProcessEngineFactory.java:54)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.executeWrite(AbstractSynchronousTransactionManager.java:182)
        at info.novatec.micronaut.camunda.bpm.feature.ProcessEngineFactory.processEngine(ProcessEngineFactory.java:53)
        at com.example.camunda.Engine.processEngine(Engine.java:44)
        at info.novatec.micronaut.camunda.bpm.feature.$ProcessEngineFactory$ProcessEngine0$Definition.build(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2336)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:3281)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:3267)
        at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2820)
        at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2782)
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1638)
        at io.micronaut.inject.provider.BeanProviderDefinition$1.get(BeanProviderDefinition.java:68)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.InitProcessEngineService.onEvent(InitProcessEngineService.java:66)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.$InitProcessEngineService$Definition$Exec.dispatch(Unknown Source)
        at io.micronaut.context.AbstractExecutableMethodsDefinition$DispatchedExecutableMethod.invoke(AbstractExecutableMethodsDefinition.java:378)
        at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:4027)
        at io.micronaut.aop.chain.AdapterIntroduction.intercept(AdapterIntroduction.java:83)
        at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.InitProcessEngineService$ApplicationEventListener$onEvent1$Intercepted.onApplicationEvent(Unknown Source)
        at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:262)
        at io.micronaut.context.event.ApplicationEventPublisherFactory.access$200(ApplicationEventPublisherFactory.java:60)
        at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:229)
        at io.micronaut.context.DefaultBeanContext.publishEvent(DefaultBeanContext.java:1733)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:80)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:34)
        at io.micronaut.runtime.Micronaut.lambda$start$2(Micronaut.java:78)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at io.micronaut.runtime.Micronaut.start(Micronaut.java:76)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:320)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:306)
        at com.example.camunda.Application.main(Application.java:8)
Caused by: org.camunda.bpm.engine.ProcessEngineException: ENGINE-03083 Unexpected exception while executing database operations with message '
### Error updating database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for insertHistoricJobLogEvent
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for insertHistoricJobLogEvent'. Flush summary: 
 [
  INSERT PropertyEntity[camunda.installation.id]
  INSERT PropertyEntity[camunda.telemetry.enabled]
  INSERT HistoricJobLogEventEntity[425fa425-f39a-11ec-af51-90e86874d763]
  INSERT EverLivingJobEntity[425df674-f39a-11ec-af51-90e86874d763]
]
        at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.flushDbOperationUnexpectedException(EnginePersistenceLogger.java:679)
        ... 46 common frames omitted
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for insertHistoricJobLogEvent
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for insertHistoricJobLogEvent
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
        at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.executeInsertEntity(DbSqlSession.java:359)
        at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.insertEntity(DbSqlSession.java:353)
        at org.camunda.bpm.engine.impl.db.AbstractPersistenceSession.executeDbOperation(AbstractPersistenceSession.java:44)
        at org.camunda.bpm.engine.impl.db.sql.BatchDbSqlSession.executeDbOperations(BatchDbSqlSession.java:62)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:341)
        ... 45 common frames omitted
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for insertHistoricJobLogEvent
        at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:1031)
        at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:821)
        at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:814)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:196)
        ... 51 common frames omitted
11:47:20.592 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Error starting HTTP server: Error instantiating bean of type  [org.camunda.bpm.engine.ProcessEngine]

Message: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
Path Taken: ProcessEngine.processEngine(ProcessEngineConfiguration processEngineConfiguration,CamundaVersion camundaVersion,SynchronousTransactionManager transactionManager,BasicJdbcConfiguration basicJdbcConfiguration,ParallelInitializationService parallelInitializationService)
io.micronaut.http.server.exceptions.HttpServerException: Error starting HTTP server: Error instantiating bean of type  [org.camunda.bpm.engine.ProcessEngine]

Message: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
Path Taken: ProcessEngine.processEngine(ProcessEngineConfiguration processEngineConfiguration,CamundaVersion camundaVersion,SynchronousTransactionManager transactionManager,BasicJdbcConfiguration basicJdbcConfiguration,ParallelInitializationService parallelInitializationService)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:92)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:34)
        at io.micronaut.runtime.Micronaut.lambda$start$2(Micronaut.java:78)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at io.micronaut.runtime.Micronaut.start(Micronaut.java:76)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:320)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:306)
        at com.example.camunda.Application.main(Application.java:8)
Caused by: io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type  [org.camunda.bpm.engine.ProcessEngine]

Message: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
Path Taken: ProcessEngine.processEngine(ProcessEngineConfiguration processEngineConfiguration,CamundaVersion camundaVersion,SynchronousTransactionManager transactionManager,BasicJdbcConfiguration basicJdbcConfiguration,ParallelInitializationService parallelInitializationService)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2363)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:3281)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:3267)
        at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2820)
        at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2782)
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1638)
        at io.micronaut.inject.provider.BeanProviderDefinition$1.get(BeanProviderDefinition.java:68)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.InitProcessEngineService.onEvent(InitProcessEngineService.java:66)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.$InitProcessEngineService$Definition$Exec.dispatch(Unknown Source)
        at io.micronaut.context.AbstractExecutableMethodsDefinition$DispatchedExecutableMethod.invoke(AbstractExecutableMethodsDefinition.java:378)
        at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:4027)
        at io.micronaut.aop.chain.AdapterIntroduction.intercept(AdapterIntroduction.java:83)
        at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
        at info.novatec.micronaut.camunda.bpm.feature.initialization.InitProcessEngineService$ApplicationEventListener$onEvent1$Intercepted.onApplicationEvent(Unknown Source)
        at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:262)
        at io.micronaut.context.event.ApplicationEventPublisherFactory.access$200(ApplicationEventPublisherFactory.java:60)
        at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:229)
        at io.micronaut.context.DefaultBeanContext.publishEvent(DefaultBeanContext.java:1733)
        at io.micronaut.servlet.engine.server.AbstractServletServer.start(AbstractServletServer.java:80)
        ... 7 common frames omitted
Caused by: org.camunda.bpm.engine.ProcessEngineException: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
        at org.camunda.bpm.engine.impl.util.ExceptionUtil.wrapPersistenceException(ExceptionUtil.java:263)
        at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.flushDbOperationUnexpectedException(EnginePersistenceLogger.java:680)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:344)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:323)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:295)
        at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:272)
        at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:188)
        at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:119)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.lambda$execute$0(MnTransactionInterceptor.java:44)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.execute(AbstractSynchronousTransactionManager.java:142)
        at info.novatec.micronaut.camunda.bpm.feature.tx.MnTransactionInterceptor.execute(MnTransactionInterceptor.java:44)
        at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
        at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
        at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.camunda.bpm.engine.impl.ProcessEngineImpl.executeSchemaOperations(ProcessEngineImpl.java:151)
        at org.camunda.bpm.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:110)
        at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:1017)
        at info.novatec.micronaut.camunda.bpm.feature.ProcessEngineFactory.lambda$processEngine$0(ProcessEngineFactory.java:54)
        at io.micronaut.transaction.support.AbstractSynchronousTransactionManager.executeWrite(AbstractSynchronousTransactionManager.java:182)
        at info.novatec.micronaut.camunda.bpm.feature.ProcessEngineFactory.processEngine(ProcessEngineFactory.java:53)
        at com.example.camunda.Engine.processEngine(Engine.java:44)
        at info.novatec.micronaut.camunda.bpm.feature.$ProcessEngineFactory$ProcessEngine0$Definition.build(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2336)
        ... 25 common frames omitted
Caused by: org.camunda.bpm.engine.ProcessEngineException: ENGINE-03083 Unexpected exception while executing database operations with message '
### Error updating database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for insertHistoricJobLogEvent
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for insertHistoricJobLogEvent'. Flush summary: 
 [
  INSERT PropertyEntity[camunda.installation.id]
  INSERT PropertyEntity[camunda.telemetry.enabled]
  INSERT HistoricJobLogEventEntity[425fa425-f39a-11ec-af51-90e86874d763]
  INSERT EverLivingJobEntity[425df674-f39a-11ec-af51-90e86874d763]
]
        at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.flushDbOperationUnexpectedException(EnginePersistenceLogger.java:679)
        ... 46 common frames omitted
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for insertHistoricJobLogEvent
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for insertHistoricJobLogEvent
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
        at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.executeInsertEntity(DbSqlSession.java:359)
        at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.insertEntity(DbSqlSession.java:353)
        at org.camunda.bpm.engine.impl.db.AbstractPersistenceSession.executeDbOperation(AbstractPersistenceSession.java:44)
        at org.camunda.bpm.engine.impl.db.sql.BatchDbSqlSession.executeDbOperations(BatchDbSqlSession.java:62)
        at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:341)
        ... 45 common frames omitted
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for insertHistoricJobLogEvent
        at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:1031)
        at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:821)
        at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:814)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:196)
        ... 51 common frames omitted
datakurre commented 2 years ago

Of course, it is possible that some of my customizations break that on my project. Need to check what you did.

Update: Curious about the fix. For me it looked like it just added one more registration to slow down the startup and possibly fix a parallel execution race condition by accident :flushed:

Anyway, I'll check 2.7.2 with minimal examples next week, and open a new issue if I can reproduce it.

This all said, it is nice to have UUID id generator configured by default. I was wondering already a little about how to do it :sweat_smile:

tobiasschaefer commented 2 years ago

@datakurre : thanks for the infos

"UnknownHostException: steamdeck: steamdeck: Name or service not known" is strange but maybe not the root cause.

I also see "IllegalArgumentException: Mapped Statements collection does not contain value for insertHistoricJobLogEvent"

It seems you have some configuration which leads to a database insert to the historic jobs during startup. Can you please find out which one triggers the error.

The Micronaut Camunda Integration is optimized that it loads MyBatis Mappings in parallel. Seems "insertHistoricJobLogEvent" is required for some scenario and is not whitelisted in the "required" mappings. However, I'd only change the internal configuration if I can reproduce the error. So I'd be happy if you could provide a minimal example.

As a workaround you can set the undocumented property camunda.two-stage-process-engine = false but startup will be slower. Does this help? How much slower is startup in your case?

btw, you could actually have configured the UUID generator by defining a custom process engine configuration.

datakurre commented 2 years ago

Updated

demo.tar.gz

This time with volatile H2 configuration and no need for docker.

In addition to H2, I only updated micronaut-camunda version, and added history: full :flushed:

camunda:
  generic-properties:
    properties:
      history: full
      history-cleanup-enabled: true
      history-cleanup-batch-window-start-time: "22:00"
datakurre commented 2 years ago

I'll create a new issue.