Getting Error: Task already scheduled or cancelled

Hi,
I have a Spring Boot application using Camunda BPM that runs fine in local Eclipse environment.
Additionally I used maven to create a WAR file to run the app on a standalone Tomcat web container.
Deployment works fine, but when I try to start the app I get an error during bootstrapping

The Tomcat manager-log shows:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘processEngineFactoryBean’: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Task already scheduled or cancelled
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1600)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1128)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1056)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:566)
… 93 more
Caused by: java.lang.IllegalStateException: Task already scheduled or cancelled
at java.util.Timer.sched(Timer.java:401)
at java.util.Timer.scheduleAtFixedRate(Timer.java:328)
at org.camunda.bpm.engine.impl.metrics.reporter.DbMetricsReporter.start(DbMetricsReporter.java:51)
at org.camunda.bpm.engine.impl.ProcessEngineImpl.(ProcessEngineImpl.java:119)
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:710)
at org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:63)
at org.camunda.bpm.engine.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:52)
at org.camunda.bpm.engine.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:31)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
… 101 more

Any ideas?

I use

  • SpringBoot, Java V1.8.0_111
  • Camunda camunda-bpm-spring-boot-starter V2.1.2
  • Camunda camunda-engine-spring V7.7.0
  • Tomcat V8.5.8
  • H2 database

Cheers, Roland

Roland,

I don’t know what Spring Boot is, so what I’m going to say is based more on a “feeling” than actual knowledge of the environment you’re operating in. That said, my “feeling” is that there is some sort of “startup” task that is failing or there is a problem with the back end database. I have experienced errors that appear to be like the above in that the synchronization between one action and the state of the database are in conflict. In other words, my process expects one state while the database is in another state.

This may have been completely useless, but I didn’t want you to think no one would at least try to help.

Michael

Hi Michael
thanks for your comforting words :slight_smile:

As far as I can see the error was triggered after I packaged and deployed two (Spring Boot) projects within one WAR file (one project contains the business logic incl Camunda the other project contains UI related topics incl Thymeleaf templates).
After packaging and deploying them into separate WAR files, everything works as expected.
So maybe I made a mistake in my configuration/POM/… when I put the two Sping projects into one WAR file.
I will close this ticket
Cheers, Roland

@Roland @mppfor_manu
Hi Guys,

When i run my unit tests using springboottest , only then i get this error.
Can you pls. advice on this?

I got this when i upgraded from 7.9.0-ee to 7.10.0-ee
I updated all spring started dependencies as well

Hello,

I don’t know if this is still an issue for others, but I recently ran into it after upgrading from 7.9.0 to 7.15.0.
I had to disable the DbMetricsReporter (which I don’t need) to get it up and running again.
See the code-snipped below.

    @Bean
    public SpringProcessEngineConfiguration processEngineConfiguration(DataSource dataSource,
            PlatformTransactionManager transactionManager) {
        SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();

        config.setDbMetricsReporterActivate(false);

Hope this helps someone.

Cheers