Reputation: 1326
I have some problems understanding Spring Boot + Camunda.
Basically I want to have a backend (REST) for my application. For that I have created a Spring Boot Java project. It runs perfectly. Now I want to include Camunda BPM workflow into my application for the processes.
I have added the dependencies to my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>de.countandcare</groupId>
<artifactId>carorderprocess</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>carorderprocess</name>
<description>Demo project for Spring Boot</description>
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from camunda -->
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-bom</artifactId>
<version>${camunda.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<java.version>1.8</java.version>
<camunda.version>7.9.0-ee</camunda.version>
<camunda.boot.version>3.0.0</camunda.boot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp-ee</artifactId>
<version>${camunda.boot.version}</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm.extension</groupId>
<artifactId>camunda-bpm-assert</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.camunda.bpm.extension</groupId>
<artifactId>camunda-bpm-mockito</artifactId>
<scope>test</scope>
<version>2.0</version>
<exclusions>
<exclusion>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.2.132</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
My Main class is:
package de.countandcare.carorderprocess;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CarorderprocessApplication {
public static void main(String[] args) {
SpringApplication.run(CarorderprocessApplication.class, args);
}
}
And I have a controller:
package de.countandcare.carorderprocess.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class OrderController {
@GetMapping(value = "/")
public String index() {
return "index";
}
}
Now I want to reach my application on localhost:8080/
which should return index.
Now when I run the application I get this error:
objc[39624]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java (0x1029c34c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x102a8b4e0). One of the two will be used. Which one is undefined.
____ _ ____ ____ __ __
/ ___| __ _ _ __ ___ _ _ _ __ __| | __ _ | __ )| _ \| \/ |
| | / _` | '_ ` _ \| | | | '_ \ / _` |/ _` | | _ \| |_) | |\/| |
| |__| (_| | | | | | | |_| | | | | (_| | (_| | | |_) | __/| | | |
\____/\__,_|_| |_| |_|\__,_|_| |_|\__,_|\__,_| |____/|_| |_| |_|
Spring-Boot: (v2.1.5.RELEASE)
Camunda BPM: (v7.9.0-ee)
Camunda BPM Spring Boot Starter: (v3.0.0)
2019-11-12 21:47:41.175 INFO 39624 --- [ main] d.c.c.CarorderprocessApplication : Starting CarorderprocessApplication on U2007750s-MBP.fritz.box with PID 39624 (/Users/u2007750/CC/Develop/projects/Kfz-Bestellprozess/backend/carorderprocess/target/classes started by u2007750 in /Users/u2007750/CC/Develop/projects/Kfz-Bestellprozess/backend/carorderprocess)
2019-11-12 21:47:41.177 INFO 39624 --- [ main] d.c.c.CarorderprocessApplication : No active profile set, falling back to default profiles: default
2019-11-12 21:47:41.888 INFO 39624 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-11-12 21:47:41.904 INFO 39624 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-11-12 21:47:41.904 INFO 39624 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.19]
2019-11-12 21:47:41.978 INFO 39624 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-11-12 21:47:41.979 INFO 39624 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 774 ms
2019-11-12 21:47:42.161 INFO 39624 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-12 21:47:42.219 INFO 39624 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [META-INF/resources/index.html]
2019-11-12 21:47:42.228 INFO 39624 --- [ main] org.camunda.bpm.spring.boot : STARTER-SB040 Setting up jobExecutor with corePoolSize=3, maxPoolSize:10
2019-11-12 21:47:42.229 INFO 39624 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'camundaTaskExecutor'
2019-11-12 21:47:42.242 WARN 39624 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'processEngineConfigurationImpl' defined in class path resource [org/camunda/bpm/spring/boot/starter/CamundaBpmConfiguration.class]: Unsatisfied dependency expressed through method 'processEngineConfigurationImpl' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'camundaDatasourceConfiguration': Unsatisfied dependency expressed through field 'transactionManager'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.transaction.PlatformTransactionManager' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2019-11-12 21:47:42.242 INFO 39624 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'camundaTaskExecutor'
2019-11-12 21:47:42.242 INFO 39624 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2019-11-12 21:47:42.244 INFO 39624 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-11-12 21:47:42.248 ERROR 39624 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Failed to destroy the filter named [Engines Filter] of type [org.camunda.bpm.spring.boot.starter.webapp.filter.LazyProcessEnginesFilter]
java.lang.NullPointerException: null
at org.camunda.bpm.spring.boot.starter.webapp.filter.LazyDelegateFilter.destroy(LazyDelegateFilter.java:49) ~[camunda-bpm-spring-boot-starter-webapp-core-3.0.0.jar:3.0.0]
at org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:301) ~[tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.StandardContext.filterStop(StandardContext.java:4562) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5380) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1393) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1382) [tomcat-embed-core-9.0.19.jar:9.0.19]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_151]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-embed-core-9.0.19.jar:9.0.19]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [na:1.8.0_151]
at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:969) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1393) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1382) [tomcat-embed-core-9.0.19.jar:9.0.19]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_151]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-embed-core-9.0.19.jar:9.0.19]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [na:1.8.0_151]
at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:969) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:475) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:994) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:465) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.stopTomcat(TomcatWebServer.java:250) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.stop(TomcatWebServer.java:306) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.stopAndReleaseWebServer(ServletWebServerApplicationContext.java:320) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at de.countandcare.carorderprocess.CarorderprocessApplication.main(CarorderprocessApplication.java:14) [classes/:na]
2019-11-12 21:47:42.249 ERROR 39624 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Failed to destroy the filter named [Security Filter] of type [org.camunda.bpm.spring.boot.starter.webapp.filter.LazySecurityFilter]
java.lang.NullPointerException: null
at org.camunda.bpm.spring.boot.starter.webapp.filter.LazyDelegateFilter.destroy(LazyDelegateFilter.java:49) ~[camunda-bpm-spring-boot-starter-webapp-core-3.0.0.jar:3.0.0]
at org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:301) ~[tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.StandardContext.filterStop(StandardContext.java:4562) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5380) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1393) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1382) [tomcat-embed-core-9.0.19.jar:9.0.19]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_151]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-embed-core-9.0.19.jar:9.0.19]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [na:1.8.0_151]
at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:969) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1393) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1382) [tomcat-embed-core-9.0.19.jar:9.0.19]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_151]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-embed-core-9.0.19.jar:9.0.19]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [na:1.8.0_151]
at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:969) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:475) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:994) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:465) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.stopTomcat(TomcatWebServer.java:250) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.stop(TomcatWebServer.java:306) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.stopAndReleaseWebServer(ServletWebServerApplicationContext.java:320) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at de.countandcare.carorderprocess.CarorderprocessApplication.main(CarorderprocessApplication.java:14) [classes/:na]
2019-11-12 21:47:42.257 INFO 39624 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-11-12 21:47:42.316 ERROR 39624 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field transactionManager in org.camunda.bpm.spring.boot.starter.configuration.impl.DefaultDatasourceConfiguration required a bean of type 'org.springframework.transaction.PlatformTransactionManager' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'transactionManager' in 'DataSourceTransactionManagerAutoConfiguration.DataSourceTransactionManagerConfiguration' not loaded because @ConditionalOnSingleCandidate (types: javax.sql.DataSource; SearchStrategy: all) did not find any beans
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.transaction.PlatformTransactionManager' in your configuration.
Process finished with exit code 1
Why is the error coming? All my maven dependencies are correctly resolved. Also how can I access the Camuna webapp, which shows me my processes/tasks etc...
Upvotes: 2
Views: 8557
Reputation: 11993
Please check the version matrix: https://docs.camunda.org/manual/7.11/user-guide/spring-boot-integration/version-compatibility/
You want to use spring boot 2.1.x with the starter 3.0.0 ... but 2.1.x support was only introduced with 3.2 Rule of thumb: use the latest versions ... especially when you start a fresh project. There is a lot going on in spring boot and some hard to maintain (jersey/mybatis) stuff in camunda ... so weird problems may occur when you mix versions.
Upvotes: 0
Reputation: 3170
Based on your stack trace i think you missed the database configuration for your H2 dB.
Please add these props in your application.propeties
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
Upvotes: 1