Unable to use the camunda operate connector

I’m trying to run the camunda operate connector using camunda self-managed 8.2.10 version deployed in docker

I have configured the template as below

It is throwing me the incident saying connection refused for localhost, I’m sure that keycloak is running in the allocated 18080 port in local

java.lang.RuntimeException: java.lang.RuntimeException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:18080 [localhost/127.0.0.1] failed: Connection refused
	at io.camunda.zeebe.spring.client.jobhandling.SpringConnectorJobHandler.failJob(SpringConnectorJobHandler.java:44)
	at io.camunda.connector.runtime.util.outbound.ConnectorJobHandler.handle(ConnectorJobHandler.java:97)
	at io.camunda.zeebe.spring.client.jobhandling.SpringConnectorJobHandler.handle(SpringConnectorJobHandler.java:37)
	at io.camunda.zeebe.spring.client.jobhandling.JobHandlerInvokingSpringBeans.lambda$handleConnectorJobWorker$0(JobHandlerInvokingSpringBeans.java:98)
	at io.micrometer.core.instrument.AbstractTimer.record(AbstractTimer.java:223)
	at io.camunda.zeebe.spring.client.actuator.MicrometerMetricsRecorder.executeWithTimer(MicrometerMetricsRecorder.java:42)
	at io.camunda.zeebe.spring.client.jobhandling.JobHandlerInvokingSpringBeans.handleConnectorJobWorker(JobHandlerInvokingSpringBeans.java:92)
	at io.camunda.zeebe.spring.client.jobhandling.JobHandlerInvokingSpringBeans.handle(JobHandlerInvokingSpringBeans.java:77)
	at io.camunda.zeebe.client.impl.worker.JobRunnableFactory.executeJob(JobRunnableFactory.java:44)
	at io.camunda.zeebe.client.impl.worker.JobRunnableFactory.lambda$create$0(JobRunnableFactory.java:39)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:18080 [localhost/127.0.0.1] failed: Connection refused
	at io.camunda.zeebe.spring.client.jobhandling.SpringConnectorJobHandler.failJob(SpringConnectorJobHandler.java:44)
	at io.camunda.connector.runtime.util.outbound.ConnectorJobHandler.lambda$handle$1(ConnectorJobHandler.java:92)
	at java.base/java.util.Optional.ifPresentOrElse(Unknown Source)
	at io.camunda.connector.runtime.util.outbound.ConnectorJobHandler.handle(ConnectorJobHandler.java:80)
	... 14 more
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:18080 [localhost/127.0.0.1] failed: Connection refused
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156)
	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
	at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
	at com.google.api.client.http.apache.v2.ApacheHttpRequest.execute(ApacheHttpRequest.java:73)
	at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1012)
	at io.camunda.connector.common.services.HTTPService.executeHttpRequest(HTTPService.java:72)
	at io.camunda.connector.common.services.HTTPService.executeHttpRequest(HTTPService.java:66)
	at io.camunda.connector.http.HttpService.getTokenFromOAuthRequest(HttpService.java:95)
	at io.camunda.connector.http.HttpService.executeRequestDirectly(HttpService.java:66)
	at io.camunda.connector.http.HttpService.executeConnectorRequest(HttpService.java:55)
	at io.camunda.connector.http.HttpJsonFunction.execute(HttpJsonFunction.java:74)
	at io.camunda.connector.runtime.util.outbound.ConnectorJobHandler.handle(ConnectorJobHandler.java:68)
	... 14 more
Caused by: java.net.ConnectException: Connection refused
	at java.base/sun.nio.ch.Net.pollConnect(Native Method)
	at java.base/sun.nio.ch.Net.pollConnectNow(Unknown Source)
	at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)
	at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)
	at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
	at java.base/java.net.Socket.connect(Unknown Source)
	at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75)
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
	... 31 more

Any configuration I’m missing here, Your insight would be helpful

Thanks in Advance
Praveen

Hi @Praveen_Kumar_Reddy,

inside the docker-compose you can’t access localhost as you do it from outside. Docker spawns a virtual network.

You have to use the container name instead of localhost.

Hope this helps, Ingo

2 Likes

Thanks @Ingo_Richtsmeier, Completely forgot to communicate with the container name

After changing to container name, I’m able to connect to the keycloak and it is giving me the the below error

java.lang.RuntimeException: java.lang.RuntimeException: io.camunda.connector.api.error.ConnectorException: 404 Not Found
POST http://keycloak:8080/realms/camunda-platform/protocol/openid-connect/token
<html><body><h1>Resource not found</h1></body></html>
	at io.camunda.zeebe.spring.client.jobhandling.SpringConnectorJobHandler.failJob(SpringConnectorJobHandler.java:44)
	at io.camunda.connector.runtime.util.outbound.ConnectorJobHandler.handle(ConnectorJobHandler.java:97)
	at io.camunda.zeebe.spring.client.jobhandling.SpringConnectorJobHandler.handle(SpringConnectorJobHandler.java:37)
	at io.camunda.zeebe.spring.client.jobhandling.JobHandlerInvokingSpringBeans.lambda$handleConnectorJobWorker$0(JobHandlerInvokingSpringBeans.java:98)
	at io.micrometer.core.instrument.AbstractTimer.record(AbstractTimer.java:223)
	at io.camunda.zeebe.spring.client.actuator.MicrometerMetricsRecorder.executeWithTimer(MicrometerMetricsRecorder.java:42)
	at io.camunda.zeebe.spring.client.jobhandling.JobHandlerInvokingSpringBeans.handleConnectorJobWorker(JobHandlerInvokingSpringBeans.java:92)
	at io.camunda.zeebe.spring.client.jobhandling.JobHandlerInvokingSpringBeans.handle(JobHandlerInvokingSpringBeans.java:77)
	at io.camunda.zeebe.client.impl.worker.JobRunnableFactory.executeJob(JobRunnableFactory.java:44)
	at io.camunda.zeebe.client.impl.worker.JobRunnableFactory.lambda$create$0(JobRunnableFactory.java:39)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: io.camunda.connector.api.error.ConnectorException: 404 Not Found

I have rectified the above error by using the documentation It was because incorrect URL given for token endpoint

After correcting it and running the connector again it is giving the incident mentioning

java.lang.RuntimeException: java.lang.RuntimeException: io.camunda.connector.api.error.ConnectorException: 401 
POST http://operate:8080/v1/process-instances/search
{"message":"the provided claims are invalid"}
	at io.camunda.zeebe.spring.client.jobhandling.SpringConnectorJobHandler.failJob(SpringConnectorJobHandler.java:44)
	at io.camunda.connector.runtime.util.outbound.ConnectorJobHandler.handle(ConnectorJobHandler.java:97)
	at io.camunda.zeebe.spring.client.jobhandling.SpringConnectorJobHandler.handle(SpringConnectorJobHandler.java:37)
	at io.camunda.zeebe.spring.client.jobhandling.JobHandlerInvokingSpringBeans.lambda$handleConnectorJobWorker$0(JobHandlerInvokingSpringBeans.java:98)
	at io.micrometer.core.instrument.AbstractTimer.record(AbstractTimer.java:223)
	at io.camunda.zeebe.spring.client.actuator.MicrometerMetricsRecorder.executeWithTimer(MicrometerMetricsRecorder.java:42)
	at io.camunda.zeebe.spring.client.jobhandling.JobHandlerInvokingSpringBeans.handleConnectorJobWorker(JobHandlerInvokingSpringBeans.java:92)
	at io.camunda.zeebe.spring.client.jobhandling.JobHandlerInvokingSpringBeans.handle(JobHandlerInvokingSpringBeans.java:77)
	at io.camunda.zeebe.client.impl.worker.JobRunnableFactory.executeJob(JobRunnableFactory.java:44)
	at io.camunda.zeebe.client.impl.worker.JobRunnableFactory.lambda$create$0(JobRunnableFactory.java:39)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: io.camunda.connector.api.error.ConnectorException: 401 

Is it regarding any permission that I need to configure

Often an error message regarding claims is permissions related. I would double check how you set up the client credentials in Identity, just in case: Authentication and authorization | Camunda Platform 8 Docs

Thank you @nathan.loding,

Connector is working fine after giving the correct permissions for operate API , Apologies Previously gave permissions for different one

I have tried the operate and tasklist API’s and by giving the Authorized oauth token as header in postman

Operate API is working only if we give the { "audience":"operate-api" } in the body as mentioned here
where as Tasklist API is working fine without any audience as tasklist-api

@Ingo_Richtsmeier what is the importance of specifying audience?

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.