Cannot start a spring boot application

While deploying a spring boot application on camunda, I am getting the following error, unable to figure out which dependency is conflicting:
Error creating bean with name ‘processEngineFactoryBean’: FactoryBean threw exception on object creation; nested exception is java.lang.ClassCastException: org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin incompatible with org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin.

The dependencies in my pom are:


org.springframework.boot
spring-boot-starter-web



org.springframework.boot
spring-boot-starter-logging

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-data-jpa</artifactId>

	</dependency>
	<dependency>
		<groupId>org.camunda.bpm.springboot</groupId>
		<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
		<version>3.4.0</version>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-tomcat</artifactId>
		<scope>provided</scope>
	</dependency>

	<dependency>
		<groupId>com.h2database</groupId>
		<artifactId>h2</artifactId>

	</dependency>
	<!-- <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> 
		<version>8.0.13</version> </dependency> -->
	<dependency>
		<groupId>org.slf4j</groupId>
		<artifactId>slf4j-api</artifactId>
	</dependency>
	<dependency>
		<groupId>log4j</groupId>
		<artifactId>log4j</artifactId>
		<version>1.2.17</version>
	</dependency>


	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>

HI,
You can use https://start.camunda.com/ to get rid of all the dependency related issues.

That has almost the same dependencies. What I want to know is does it take from the dependency of camunda-engine-plugin-connect ? Though I dont have it explicitly called out in my pom, should I try and exclude it? Have been stuck on the deployment for 2 days now, any suggestions are welcome. Thanks in advance

How are you deploying it ?

Auto deployment of war(webapp) using tomcat

@Shreyoshi_Das how does your pom.xml looks like? Can you upload it? Are you using any connectors in camunda? If not camunda connect plugin is not required, so you can remove in that case.

java.lang.ClassCastException: org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin incompatible with org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin - This is the exception. Attaching the pom being used. I have added camunda connect dependency in exclusion but didn’t find a resolution. Please suggest a resolution.pom.xml (5.5 KB)

Also attaching the entire logs:
java.lang.IllegalStateException: Error starting child
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:720)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:978)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1849)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:773)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1576)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/N2JCAdapter]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
… 37 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘otmSpringBootApplication’: Unsatisfied dependency expressed through field ‘runtimeService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.camunda.bpm.engine.spring.SpringProcessEngineServicesConfiguration’: Unsatisfied dependency expressed through field ‘processEngine’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘processEngineFactoryBean’: FactoryBean threw exception on object creation; nested exception is java.lang.ClassCastException: org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin incompatible with org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:397)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1429)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$195.0000000013CABAF0.getObject(Unknown Source)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:152)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:132)
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:92)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
… 38 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.camunda.bpm.engine.spring.SpringProcessEngineServicesConfiguration’: Unsatisfied dependency expressed through field ‘processEngine’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘processEngineFactoryBean’: FactoryBean threw exception on object creation; nested exception is java.lang.ClassCastException: org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin incompatible with org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:397)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1429)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$195.0000000013CABAF0.getObject(Unknown Source)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:400)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$195.0000000013CABAF0.getObject(Unknown Source)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:636)
… 61 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘processEngineFactoryBean’: FactoryBean threw exception on object creation; nested exception is java.lang.ClassCastException: org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin incompatible with org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1818)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1266)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:636)
… 85 more
Caused by: java.lang.ClassCastException: org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin incompatible with org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin
at org.camunda.bpm.engine.impl.cfg.CompositeProcessEnginePlugin.preInit(CompositeProcessEnginePlugin.java:92)
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.invokePreInit(ProcessEngineConfigurationImpl.java:1068)
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:823)
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:814)
at org.camunda.bpm.engine.spring.SpringTransactionsProcessEngineConfiguration.buildProcessEngine(SpringTransactionsProcessEngineConfiguration.java:63)
at org.camunda.bpm.engine.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:55)
at org.camunda.bpm.engine.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:34)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171)
… 94 more

@Shreyoshi_Das how are you bootstrapping the process engine? Java configuration?

Spring boot version is 2.2.1.RELEASE and Java is 1.8. I am doing auto webapp deployment of the war generated from the project. Am I doing something wrong? Also are the versions fine?

What about camunda version?

When you use spring boot, war deployment not required, it may fail if you package as a war file, because spring boot application has embedded server. It should be packaged as a jar

2.2.1.RELEASE UTF-8 1.8
	<camunda.version>7.12.0</camunda.version>
	<camundaSpringBoot.version>3.4.0</camundaSpringBoot.version>
</properties>

sorry, i am new to Camunda, how do we deploy jar over camunda?

Hi @Shreyoshi_Das if you are deploying under apache tomcat camunda distribution then when building your war file you don’t need camunda dependency again. Just Mention scope as Provided so camunda library won’t be added again in your war file.

@Shreyoshi_Das yes nothing required because distribution has all this.

@Shreyoshi_Das you need while compilation not during runtime ( because camunda distribution provides) . You have to mention provided so it will be available during complie time but not be added to your war file.

If we give as provided then it starts as a Spring application instead of Camunda and fails to load the primary class itself.
e[1;31mERRORe[0;39m o.s.boot.SpringApplication.reportFailure - Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.shreyoshi.OtmSpringBootApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class com.shreyoshi.OtmSpringBootApplication
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:184)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:325)

Can you share the project in github which can reproduce the issue? Will be easier to identify the issue

Now I have added only camunda-bpm-spring-boot-starter-webapp as a dependency in pom under provided scope. With that the camunda exception has gone but an exception saying it o.s.boot.SpringApplication.reportFailure - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘xyz’: Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class