Spin problem in Camunda Spring Boot


#1

I have Camunda Spring Boot project with webapp and rest modules.

I don’t have any problem with Spin when running application.
I don’t have any problem with Spin when running BPMN engine in unit test (starting new process, completing tasks, a.s.o).
But i have Spin problems when trying to start process over REST service in unit test.

Exception is:
org.camunda.bpm.engine.rest.exception.RestException: Cannot instantiate process definition approve-loan:1:1237174c-538b-11e8-bc3c-f0d5bfded317:
Error while evaluating expression: ${S(json).hasProp(‘approved’) && S(json).prop(‘approved’).boolValue()}. Cause: Error invoking function ‘S’

Unit test is:

@Test
public void testStartProcess() throws Exception {
String url = “/rest/engine/default/process-definition/” + processDefinitionId + “/start”;
String json = “{“loanSize”:177,“approved”:false,“nit”:123,“tp0joc2upj5”:“My company”}”;
VariableMap variables = Variables.createVariables()
.putValue(“json”, json)
.putValue(“starter”, Variables.stringValue(“democlient”))
.putValue(“fileDraftId”, Variables.stringValue((“onefileDraftId123”)));
ResponseEntity response = testRestTemplate.postForEntity(url, new HttpEntity<>(variables, headers), ProcessInstanceDto.class);
assertEquals(200, response.getStatusCode().value());
}

Spin dependency in Maven pom:

		<dependency>
			<groupId>org.camunda.bpm</groupId>
			<artifactId>camunda-engine-plugin-spin</artifactId>
			<version>7.8.0</version>
		</dependency>
		<dependency>
			<groupId>org.camunda.spin</groupId>
			<artifactId>camunda-spin-dataformat-json-jackson</artifactId>
			<version>1.5.0</version>
		</dependency>
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
			<version>20180130</version>
		</dependency>

With best,
Erki


#2

Hi Erki,

can you please provide your entire pom.xml file?

Cheers,
Tassilo


#3

yes, please, here it is:

<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">
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.unctad.eregistrations</groupId>
	<artifactId>camunda-boot</artifactId>
	<version>1.0.0</version>
	<properties>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<spring-boot.version>2.0.1.RELEASE</spring-boot.version>
		<camunda.version>7.8.0-SNAPSHOT</camunda.version>
		<springfox.version>2.8.0</springfox.version>
		<org.mustache.java.version>0.9.5</org.mustache.java.version>
		<camunda.spring.boot.starter.version>2.3.0</camunda.spring.boot.starter.version>
	</properties>
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-dependencies</artifactId>
				<version>${spring-boot.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<dependencies>
		<dependency>
			<groupId>org.camunda.bpm.springboot</groupId>
			<artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
			<version>${camunda.spring.boot.starter.version}</version>
		</dependency>
		<dependency>
			<groupId>org.camunda.bpm.springboot</groupId>
			<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
			<version>${camunda.spring.boot.starter.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-autoconfigure</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-security</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jdbc</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.security</groupId>
			<artifactId>spring-security-jwt</artifactId>
			<version>1.0.9.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-activemq</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.activemq</groupId>
			<artifactId>activemq-broker</artifactId>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
		</dependency>
		<dependency>
			<groupId>org.camunda.commons</groupId>
			<artifactId>camunda-commons-utils</artifactId>
			<version>1.5.0</version>
		</dependency>
		<dependency>
			<groupId>org.apache.httpcomponents</groupId>
			<artifactId>httpclient</artifactId>
		</dependency>
		<dependency>
			<groupId>io.jsonwebtoken</groupId>
			<artifactId>jjwt</artifactId>
			<version>0.9.0</version>
		</dependency>
		<dependency>
			<groupId>org.camunda.bpm</groupId>
			<artifactId>camunda-engine-plugin-spin</artifactId>
			<version>7.8.0</version>
		</dependency>
		<dependency>
			<groupId>org.camunda.spin</groupId>
			<artifactId>camunda-spin-dataformat-json-jackson</artifactId>
			<version>1.5.0</version>
		</dependency>
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
			<version>20180130</version>
		</dependency>
		<dependency>
			<groupId>com.github.spullara.mustache.java</groupId>
			<artifactId>compiler</artifactId>
			<version>${org.mustache.java.version}</version>
		</dependency>
		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
		</dependency>
		<dependency>
			<groupId>org.flywaydb</groupId>
			<artifactId>flyway-core</artifactId>
		</dependency>
		<dependency>
			<groupId>io.springfox</groupId>
			<artifactId>springfox-swagger2</artifactId>
			<version>${springfox.version}</version>
		</dependency>
		<dependency>
			<groupId>io.springfox</groupId>
			<artifactId>springfox-swagger-ui</artifactId>
			<version>${springfox.version}</version>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.17</version>
		</dependency>
		<dependency>
		    <groupId>org.graylog2</groupId>
		    <artifactId>gelfj</artifactId>
		    <version>1.1.15</version>
		</dependency>
		<!-- testing -->
		<dependency>
			<groupId>org.camunda.bpm.springboot</groupId>
			<artifactId>camunda-bpm-spring-boot-starter-test</artifactId>
			<version>${camunda.spring.boot.starter.version}</version>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.assertj</groupId>
					<artifactId>assertj-core</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.assertj</groupId>
			<artifactId>assertj-core</artifactId>
			<scope>test</scope>
			<version>3.8.0</version>
		</dependency>
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
		    <groupId>org.apache.activemq.tooling</groupId>
		    <artifactId>activemq-junit</artifactId>
		    <version>5.15.3</version>
		    <scope>test</scope>
		</dependency> 
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.7.0</version>
				<configuration>
					<source>${maven.compiler.source}</source>
					<target>${maven.compiler.target}</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<layout>ZIP</layout>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

</project>

#4

Hi Erki,

at the first glance I noticed that you use 2.0.1.RELEASE as ${spring-boot.version}. Camunda Spring Boot Starter 2.3.0 is dependent of Spring Boot 1.5.8.RELEASE.

Cheers,
Tassilo