I am trying to follow the quick start guide to create a flow with service task (Executing automated steps (2/6) | docs.camunda.org). When I try to run the node.js script with node ./worker.js I get error “polling failed with undefined”. My process engine is running, I am able to deploy and execute processes with user task and business rule tasks.
Configuration:
Mac - OS Mojave v10.14.3
Node.js - 10.15.3
java - 11.0.1
Logs - Catalin.out
12-Mar-2019 17:34:16.375 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/Users/kh2406/Downloads/Camunda/camunda-bpm-ee-tomcat-7.10.3-ee/server/apache-tomcat-9.0.12/webapps/engine-rest]
12-Mar-2019 17:34:16.496 FINE [main] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
12-Mar-2019 17:34:16.565 SEVERE [main] org.apache.catalina.core.StandardContext.startInternal One or more Filters failed to start. Full details will be found in the appropriate container log file
12-Mar-2019 17:34:16.567 SEVERE [main] org.apache.catalina.core.StandardContext.startInternal Context [/engine-rest] startup failed due to previous errors
12-Mar-2019 17:34:16.585 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/Users/kh2406/Downloads/Camunda/camunda-bpm-ee-tomcat-7.10.3-ee/server/apache-tomcat-9.0.12/webapps/engine-rest] has finished in [210] ms
// configuration for the Client:
// - ‘baseUrl’: url to the Process Engine
// - ‘logger’: utility to automatically log important events
// - ‘asyncResponseTimeout’: long polling timeout (then a new request will be issued)
const config = { baseUrl: ‘http://localhost:8080/engine-rest’, use: logger, asyncResponseTimeout: 50000 };
// create a Client instance with custom configuration
const client = new Client(config);
// susbscribe to the topic: ‘charge-card’
client.subscribe(‘charge-card’, async function({ task, taskService }) {
// Put your business logic here
// Get a process variable
const amount = task.variables.get(‘amount’);
const item = task.variables.get(‘item’);
console.log(Charging credit card with an amount of ${amount}€ for the item '${item}'...);
// Complete the task
await taskService.complete(task);
});
I was able to get this working by replacing some single quotes with double quotes
const { Client, logger } = require("camunda-external-task-client-js");
// configuration for the Client:
// - ‘baseUrl’: url to the Process Engine
// - ‘logger’: utility to automatically log important events
// - ‘asyncResponseTimeout’: long polling timeout (then a new request will be issued)
const config = { baseUrl: "http://localhost:8080/engine-rest", use: logger, asyncResponseTimeout: 50000 };
// create a Client instance with custom configuration
const client = new Client(config);
// susbscribe to the topic: ‘charge-card’
client.subscribe("charge-card", async function({ task, taskService }) {
// Put your business logic here
// Get a process variable
const amount = task.variables.get("amount");
const item = task.variables.get("item");
console.log("Charging credit card with an amount of ${amount}€ for the item '${item}'...");
// Complete the task
await taskService.complete(task);
});
I am still seeing “polling failed with undefined” with this updated worker.js
and there’s one more problem:
When I am trying to deploy any workflow from modeler it gives me error
“Error: invalid json response body at http://localhost:8080/engine-rest/deployment/create reason: Unexpected end of JSON input”
but i am able to deploy the same workflow from cockpit.
According to the logs you posted when tomcat is starting it’s throwing a whole bunch of errors including:
Caused by: java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:461)
at java.base/sun.nio.ch.Net.bind(Net.java:453)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80)
at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:236)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:210)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1044)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:540)
at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:74)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:932)
... 13 more
Which indicates that you might have something else - not the engine - on that port. the worker does not run on port 8080 it simply polls that port.
**its when I start the camunda server, the port is occupied.
kh2406-temp:charge-card-worker kh2406$ lsof -i:8080
kh2406-temp:charge-card-worker kh2406$ sh /Users/kh2406/Downloads/Camunda/camunda-bpm-ee-tomcat-7.10.3-ee/start-camunda.sh
starting camunda BPM platform on Tomcat Application Server
Using CATALINA_BASE: /Users/kh2406/Downloads/Camunda/camunda-bpm-ee-tomcat-7.10.3-ee/server/apache-tomcat-9.0.12
Using CATALINA_HOME: /Users/kh2406/Downloads/Camunda/camunda-bpm-ee-tomcat-7.10.3-ee/server/apache-tomcat-9.0.12
Using CATALINA_TMPDIR: /Users/kh2406/Downloads/Camunda/camunda-bpm-ee-tomcat-7.10.3-ee/server/apache-tomcat-9.0.12/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
Using CLASSPATH: /Users/kh2406/Downloads/Camunda/camunda-bpm-ee-tomcat-7.10.3-ee/server/apache-tomcat-9.0.12/bin/bootstrap.jar:/Users/kh2406/Downloads/Camunda/camunda-bpm-ee-tomcat-7.10.3-ee/server/apache-tomcat-9.0.12/bin/tomcat-juli.jar
Tomcat started.
kh2406-temp:charge-card-worker kh2406$ lsof -i:8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 995 kh2406 65u IPv6 0x561079e100940223 0t0 TCP *:http-alt (LISTEN)
kh2406-temp:charge-card-worker kh2406$ -e We are sorry… We tried all we could do but we couldn’t locate your default browser…
If you want to see our default website please open your browser and insert this URL:
ilsof -i:8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 995 kh2406 65u IPv6 0x561079e100940223 0t0 TCP *:http-alt (LISTEN)
So, i was able to start and run your worker without any problems locally myself… so lets go through each component to find the issue.
First if Camunda is running correctly you should be able to go to this link http://localhost:8080/ and see the tomcat homepage
then you should be able to go to this link http://localhost:8080/camunda
and you should see tasklist and then log in.
AH-HA!
We’ve found the problem - your REST API is missing.
Have you changed anything about the regular distro?
Did you install camunda manually to tomcat?
I extracted the zip file and started camunda in terminal by running command
kh2406-temp:~ kh2406$ sh /Users/kh2406/Downloads/Camunda/camunda-bpm-ee-tomcat-7.10.3-ee/start-camunda.sh
The Problem is occurring only in enterprise version. I tried with the community version and I was able to execute the steps.
In enterprise the tomcat server starts, cockpit and tasklist apps are working fine, but the engine rest is not starting. So there is a problem in enterprise installation.
It’s a really strange problem that i’ve never come across before.
There wouldn’t be too much of a difference between the CE and EE REST API so it’s even stranger that the CE version works.
The version I was using was 7.10.3-ee Apache Tomcat. And its only the engine-rest, that’s hitting issue while starting other apps are very well running.