Not able to start a process through REST call getting "No process engine available"


#1

I am using a springBoot integration for Camunda:

I have created a process “GemmaTestBPM”, which I am able to trigger from “tasklist” from GUI.

But I am getting “No process engine available” message when triggering from Postman.

Below is the dependencies I have added in pom.xml:

org.camunda.bpm.springboot
camunda-bpm-spring-boot-starter-rest
3.3.1

Below is the Rest Call:

http://localhost:8080/rest/process-definition/key/GemmaTestBPM/start
Body:
{
“variables”: {
“customerId”:{“value”:“123”,“type”:“String”},
“fileId”:{“value”:“234234”,“type”:“String”}
},“businessKey” : “12345”
}

Please help me to trigger the process from REST Call.


#2

@abhidynmc for rest api, try like this below:

http://localhost:8080/engine-rest/process-definition/key/GemmaTestBPM/start

The rest api servlet context path is /engine-rest/


#3

Hi Aravindh,

I tried this but it did not work:

image


#4
  • can you provide your pom.xml or build.gradle?
  • Can you provide application server log?
  • Have you included camunda-bpm-spring-boot-starter-rest dependency in classpath?
  • Did you enabled Spring security or camunda basic authentication?
  • Try this http://localhost:8080/engine-rest/engine will list the process engine like below if process engine was bootstrapped properly.
[{"name":"default"},
{"name":"anotherEngineName"}]

#5

Here is my pom.xml

pom.xml (4.8 KB)

Below is the server logs:

2019-08-14 11:43:09 - POST “/engine-rest/process-definition/key/GemmaTestBPM/start”, parameters={}
2019-08-14 11:43:09 - Mapped to ResourceHttpRequestHandler [“classpath:/META-INF/resources/”, “classpath:/resources/”, “classpath:/static/”, “classpath:/public/”, “/”]
2019-08-14 11:43:09 - Opening JPA EntityManager in OpenEntityManagerInViewInterceptor
2019-08-14 11:43:09 - Resource not found
2019-08-14 11:43:09 - Closing JPA EntityManager in OpenEntityManagerInViewInterceptor
2019-08-14 11:43:09 - Completed 404 NOT_FOUND
2019-08-14 11:43:09 - “ERROR” dispatch for POST “/error”, parameters={}
2019-08-14 11:43:09 - Mapped to public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2019-08-14 11:43:09 - Opening JPA EntityManager in OpenEntityManagerInViewInterceptor
2019-08-14 11:43:09 - Using ‘application/json’, given [/] and supported [application/json, application/+json, application/json, application/+json]
2019-08-14 11:43:09 - Writing [{timestamp=Wed Aug 14 11:43:09 IST 2019, status=404, error=Not Found, message=No message available, (truncated)…]
2019-08-14 11:43:09 - Closing JPA EntityManager in OpenEntityManagerInViewInterceptor
2019-08-14 11:43:09 - Exiting from “ERROR” dispatch, status 404

Also, I am getting below response when hitting http://localhost:8080/rest/engine :
[{“name”:“GEMMABPM”}]

And when I am hitting this: http://localhost:8080/rest/process-definition/key/GemmaTestBPM/start in postman as POST call:

I am getting this response:

{
“type”: “InvalidRequestException”,
“message”: “No process engine available”
}

Below are the logs:

2019-08-14 11:46:45 - Closing JPA EntityManager [SessionImpl(1008276882)] after transaction
2019-08-14 11:46:46 - org.camunda.bpm.engine.rest.exception.InvalidRequestException: No process engine available
at org.camunda.bpm.engine.rest.impl.AbstractRestProcessEngineAware.getProcessEngine(AbstractRestProcessEngineAware.java:39)
at org.camunda.bpm.engine.rest.impl.ProcessDefinitionRestServiceImpl.getProcessDefinitionByKey(ProcessDefinitionRestServiceImpl.java:56)
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.glassfish.jersey.server.internal.routing.SubResourceLocatorRouter.lambda$getResource$0(SubResourceLocatorRouter.java:156)
at org.glassfish.jersey.server.internal.routing.SubResourceLocatorRouter.getResource(SubResourceLocatorRouter.java:174)
at org.glassfish.jersey.server.internal.routing.SubResourceLocatorRouter.apply(SubResourceLocatorRouter.java:110)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:110)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:113)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:113)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:113)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:113)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:113)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:113)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:113)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:113)
at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:93)
at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:62)
at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:269)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
at org.glassfish.jersey.internal.Errors.process(Errors.java:268)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:416)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

2019-08-14 11:46:49 - Creating new transaction with name [null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
2019-08-14 11:46:49 - Opened new EntityManager [SessionImpl(1774182266)] for JPA transaction


#6
  • Which version of MySQL database are you using?
  • Also can you check whether you are using compatible mysql connector version for the mysql database version?

#7

It is 5.7 and I am using below dependencies:

mysql mysql-connector-java

#8

what’s the connector version you are using?

For mysql version 5.7, the mysql connector version should be, compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.16'


#9

I used the above config

image

But still no luck still getting “No process engine available” as response.


#10

I also tried the Java API approach:

@GetMapping("/startProcessByName/{processName}")
public String startProcess(@PathVariable(“processName”) String processName) {
RepositoryService repoService=processEngine.getRepositoryService();
RuntimeService runTime=processEngine.getRuntimeService();
ProcessDefinition pd = processEngine.getRepositoryService().createProcessDefinitionQuery()
.processDefinitionKey(processName)
.processDefinitionVersion(1).singleResult();
// runTime.setVariable(pd.getId(), “fileId”, “23234”);
// runTime.startProcessInstanceById(pd.getId());

	processEngine.getRuntimeService().startProcessInstanceById(pd.getId());
	runTime.setVariable(pd.getId(), "fileId", "23234");
	runTime.setVariable(pd.getId(), "customerId", "23234");
	return "Success";
}

The process triggers a Java Delegate ${executeChange} it uses a Autowired service to call one method inside execute method.

From web app when I am triggering the process it is working and the api that I built, its able to trigger the process but giving null for my autowired service.

I dont know what I am doing wrong.


#11

@abhidynmc do you have included this dependency in your classpath?

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jdbc</artifactId>
    <version>2.1.7.RELEASE</version>
</dependency>

#12

I tried that but no luck. Can you please share the necessary dependencies for the rest api setup with springboot.