title: Error creating bean with name 'processEngine' in Spring Boot and Activiti
body: <p>I am new to Activiti and Spring Boot. I am following the <a href="https://spring.io/blog/2015/03/08/getting-started-with-activiti-and-spring-boot" rel="nofollow noreferrer">Getting started with Activiti and Spring Boot blog</a>. So far I've only created a simple workflow with start event, store resume service task and end event. When I run the Spring boot app, it gives me an <code>Error creating bean with name 'processEngine'</code> exception. Following is my full exception log:</p>
  
  <pre><code>Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'runtimeServiceBean' defined in class path resource [org/activiti/spring/boot/DataSourceProcessEngineAutoConfiguration$DataSourceProcessEngineConfiguration.class]: Unsatisfied dependency expressed through method 'runtimeServiceBean' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: org/activiti/bpmn/constants/BpmnXMLConstants
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:767)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:508)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
      at com.test.myResume.MyResumeApplication.main(MyResumeApplication.java:15)
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: org/activiti/bpmn/constants/BpmnXMLConstants
      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:1647)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1216)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:257)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1462)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1419)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1202)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166)
      at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:855)
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:758)
      ... 18 more
  Caused by: java.lang.NoClassDefFoundError: org/activiti/bpmn/constants/BpmnXMLConstants
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      at org.activiti.engine.impl.cfg.DefaultBpmnParseFactory.createBpmnParse(DefaultBpmnParseFactory.java:25)
      at org.activiti.engine.impl.bpmn.parser.BpmnParser.createParse(BpmnParser.java:59)
      at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:109)
      at org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:58)
      at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:106)
      at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:37)
      at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
      at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
      at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
      at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
      at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
      at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
      at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
      at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:78)
      at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:156)
      at org.activiti.spring.autodeployment.DefaultAutoDeploymentStrategy.deployResources(DefaultAutoDeploymentStrategy.java:64)
      at org.activiti.spring.SpringProcessEngineConfiguration.autoDeployResources(SpringProcessEngineConfiguration.java:111)
      at org.activiti.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:67)
      at org.activiti.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:60)
      at org.activiti.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:32)
      at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171)
      ... 30 more
  Caused by: java.lang.ClassNotFoundException: org.activiti.bpmn.constants.BpmnXMLConstants
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 64 more
  </code></pre>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.test&lt;/groupId&gt;
      &lt;artifactId&gt;myResume&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;myResume&lt;/name&gt;
      &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.1.0.RELEASE&lt;/version&gt;
          &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;activiti.version&gt;5.19.0.2&lt;/activiti.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.activiti&lt;/groupId&gt;
              &lt;artifactId&gt;activiti-spring-boot-starter-basic&lt;/artifactId&gt;
              &lt;version&gt;${activiti.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.h2database&lt;/groupId&gt;
              &lt;artifactId&gt;h2&lt;/artifactId&gt;
              &lt;version&gt;1.4.185&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>hiringProcess.bpmn</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test"&gt;
    &lt;process id="hiringProcess" name="Hiring process" isExecutable="true"&gt;
      &lt;startEvent id="startevent1" name="Start"&gt;&lt;/startEvent&gt;
      &lt;serviceTask id="storeResume" name="Store Resume" activiti:expression="${resumeService.storeResume()}"&gt;&lt;/serviceTask&gt;
      &lt;sequenceFlow id="flow1" sourceRef="startevent1" targetRef="storeResume"&gt;&lt;/sequenceFlow&gt;
      &lt;endEvent id="endevent1" name="End"&gt;&lt;/endEvent&gt;
      &lt;sequenceFlow id="flow2" sourceRef="storeResume" targetRef="endevent1"&gt;&lt;/sequenceFlow&gt;
    &lt;/process&gt;
    &lt;bpmndi:BPMNDiagram id="BPMNDiagram_hiringProcess"&gt;
      &lt;bpmndi:BPMNPlane bpmnElement="hiringProcess" id="BPMNPlane_hiringProcess"&gt;
        &lt;bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1"&gt;
          &lt;omgdc:Bounds height="35.0" width="35.0" x="160.0" y="170.0"&gt;&lt;/omgdc:Bounds&gt;
        &lt;/bpmndi:BPMNShape&gt;
        &lt;bpmndi:BPMNShape bpmnElement="storeResume" id="BPMNShape_storeResume"&gt;
          &lt;omgdc:Bounds height="55.0" width="105.0" x="240.0" y="160.0"&gt;&lt;/omgdc:Bounds&gt;
        &lt;/bpmndi:BPMNShape&gt;
        &lt;bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1"&gt;
          &lt;omgdc:Bounds height="35.0" width="35.0" x="390.0" y="170.0"&gt;&lt;/omgdc:Bounds&gt;
        &lt;/bpmndi:BPMNShape&gt;
        &lt;bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1"&gt;
          &lt;omgdi:waypoint x="195.0" y="187.0"&gt;&lt;/omgdi:waypoint&gt;
          &lt;omgdi:waypoint x="240.0" y="187.0"&gt;&lt;/omgdi:waypoint&gt;
        &lt;/bpmndi:BPMNEdge&gt;
        &lt;bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2"&gt;
          &lt;omgdi:waypoint x="345.0" y="187.0"&gt;&lt;/omgdi:waypoint&gt;
          &lt;omgdi:waypoint x="390.0" y="187.0"&gt;&lt;/omgdi:waypoint&gt;
        &lt;/bpmndi:BPMNEdge&gt;
      &lt;/bpmndi:BPMNPlane&gt;
    &lt;/bpmndi:BPMNDiagram&gt;
  &lt;/definitions&gt;
  </code></pre>
  
  <p><strong>MyResumeApplication.java</strong></p>
  
  <pre><code>package com.test.myResume;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class MyResumeApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(MyResumeApplication.class, args);
      }
  }
  </code></pre>
  
  <p>I have tried both with and without the <code>CommandLineRunner init bean</code> as used in the above mentioned blog, but it gives me the same exception, so I believe the exception is not occurring because of it. The only difference I can find is that the blog uses spring boot v1.2.0.RELEASE and I'm using v2.1.0.RELEASE.
  I also tried defining the process engine bean as stated in <a href="https://community.alfresco.com/thread/237730-newbie-using-activiti-6-and-springboot-201#comment-body-834695" rel="nofollow noreferrer">this post</a>, but that doesn't seem to work either.</p>
  
  <p><a href="https://www.baeldung.com/activiti-process-engine" rel="nofollow noreferrer">This post</a> states to define a process engine in an XML file called <code>activiti.cfg.xml</code>, but I can find no such file. Do I need to create this file?</p>
  
  <p>I'm having a hard time figuring this out. Any help will be appreciated. Thanks.</p>