Unable to connect to self managed tasklist using tasklist client

I am trying to connect to self managed camunda(helm chart 10.2.0) tasklist from a spring boot application. But it is throwing below exception on startup

Caused by: io.camunda.identity.sdk.impl.rest.exception.RestException: request failed with status code '404' and body '{"error":"Unable to find matching target resource method"}'
        at io.camunda.identity.sdk.impl.rest.RestClient.send(RestClient.java:123) ~[identity-sdk-8.5.2.jar:8.5.2]
        at io.camunda.identity.sdk.impl.rest.RestClient.request(RestClient.java:105) ~[identity-sdk-8.5.2.jar:8.5.2]

Client config:

package com.transaction.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


import io.camunda.tasklist.CamundaTaskListClient;
import io.camunda.tasklist.exception.TaskListException;

@Configuration
public class TaskListClientConfig {

    @Value("${taskList.url}")
    private String taskListUrl;

    @Value("${taskList.clientId}")
    private String taskListClientId;

    @Value("${taskList.clientSecret}")
    private String taskListClientSecret;

    @Value("${keycloakUrl}")
    private String keycloakUrl;

    @Bean
    public CamundaTaskListClient client() throws TaskListException{
        return CamundaTaskListClient.builder()
        .taskListUrl(taskListUrl)
        .selfManagedAuthentication(taskListClientId, taskListClientSecret, keycloakUrl)
        .build();
    }    
}

application.properties:

taskList.url=http://127.0.0.1:8095
taskList.clientId=tasklist
taskList.clientSecret=xxxxxxxx
keycloakUrl=http://127.0.0.1:8096/auth

dependencies:

 <dependency>
    <groupId>io.camunda.spring</groupId>
    <artifactId>spring-boot-starter-camunda</artifactId>
    <version>8.5.4</version>
  </dependency>
  <dependency>
    <groupId>io.camunda</groupId>
    <artifactId>camunda-tasklist-client-java</artifactId>
    <version>8.5.3.4</version>
  </dependency>

spring boot : 3.2.5

JFYI i am using zeebe client as well

camunda.client.mode=oidc
camunda.client.auth.oidc-type=keycloak
camunda.client.auth.client-id=zeebe
camunda.client.auth.client-secret=c5ZUlrSySar50xm
camunda.client.auth.issuer=https://camunda.services.vietcombank.virtusa.dev/auth/realms/camunda-platform
camunda.client.zeebe.enabled=true
camunda.client.zeebe.gateway-url=http://127.0.0.1:26500
camunda.client.zeebe.base-url=http://127.0.0.1:8087
camunda.client.zeebe.prefer-rest-over-grpc=false
camunda.client.zeebe.audience=zeebe-api

Hi, is there any update on this issue.
I am trying to integrate the self managed camunda 8 and getting same issue

Hello @rashidRizvi98 ,

the exception seems to be related to identity client. It seems that you are not using the default port, so you have to configure the identity base-url in your application.properties file as explained in spring-zeebe/README.md at main · camunda-community-hub/spring-zeebe · GitHub

I hope this solves your issue.

Best regards,

When i am trying to connect with tasklist i am getting the following error in identity-sdk-8.5.1 jar

request failed with status code ‘404’ and body ‘{“error”:“Unable to find matching target resource method”}’

@Configuration
public class TaskListConfig {

    private static final Logger log = LoggerFactory.getLogger(TaskListConfig.class);
    @Value("${profile}")
    private String profile;

    @Value("${tasklist.base-url}")
    private String tasklistBaseUrl;

    @Value("${tasklist.username}")
    private String tasklistUsername;

    @Value("${tasklist.password}")
    private String tasklistPassword;

    @Value("${identity.keycloak-url}")
    private String keycloakUrl;

    @Value("${identity.client-id}")
    private String clientId;

    @Value("${identity.client-secret}")
    private String clientSecret;

    @Bean
    public CamundaTaskListClient camundaTaskListClient() throws TaskListException {

        if (SpringProfile.LOCAL.value.equalsIgnoreCase(profile)) {
            SimpleConfig simpleConf = new SimpleConfig();
            simpleConf.addProduct(Product.TASKLIST, new SimpleCredential(tasklistBaseUrl, tasklistUsername, tasklistPassword));

            return CamundaTaskListClient.builder()
                    .authentication(
                            SimpleAuthentication.builder()
                                    .withSimpleConfig(simpleConf)
                                    .build()
                    )
                    .taskListUrl(tasklistBaseUrl)
                    .build();
        } else {
            log.info("url: {}", tasklistBaseUrl);
            return CamundaTaskListClient.builder()
                    .selfManagedAuthentication(clientId, clientSecret, keycloakUrl)
                    .taskListUrl(tasklistBaseUrl)
                    .build();
        }
    }```

Hello @shubamvirdi ,

can you please share the full exception stacktrace that you get?

Best regards,

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camundaTaskListClient' defined in class path resource [com/example/camunda8sample/config/TaskListConfig.class]: Failed to instantiate [io.camunda.tasklist.CamundaTaskListClient]: Factory method 'camundaTaskListClient' threw exception with message: request failed with status code '404' and body '{"error":"Unable to find matching target resource method"}'
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:485) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1355) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1185) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1443) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:782) ~[spring-beans-6.1.12.jar:6.1.12]
	... 33 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.camunda.tasklist.CamundaTaskListClient]: Factory method 'camundaTaskListClient' threw exception with message: request failed with status code '404' and body '{"error":"Unable to find matching target resource method"}'
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:178) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644) ~[spring-beans-6.1.12.jar:6.1.12]
	... 47 common frames omitted
Caused by: io.camunda.identity.sdk.impl.rest.exception.RestException: request failed with status code '404' and body '{"error":"Unable to find matching target resource method"}'
	at io.camunda.identity.sdk.impl.rest.RestClient.send(RestClient.java:123) ~[identity-sdk-8.5.1.jar:8.5.1]
	at io.camunda.identity.sdk.impl.rest.RestClient.request(RestClient.java:105) ~[identity-sdk-8.5.1.jar:8.5.1]
	at io.camunda.identity.sdk.impl.keycloak.KeycloakAuthentication.requestFreshToken(KeycloakAuthentication.java:91) ~[identity-sdk-8.5.1.jar:8.5.1]
	at io.camunda.identity.sdk.authentication.AbstractAuthentication.requestToken(AbstractAuthentication.java:91) ~[identity-sdk-8.5.1.jar:8.5.1]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
	at io.camunda.identity.sdk.annotation.AnnotationProcessor.lambda$apply$0(AnnotationProcessor.java:33) ~[identity-sdk-8.5.1.jar:8.5.1]
	at jdk.proxy2/jdk.proxy2.$Proxy90.requestToken(Unknown Source) ~[na:na]
	at io.camunda.common.auth.SelfManagedAuthentication.getIdentityToken(SelfManagedAuthentication.java:31) ~[java-common-8.5.3.jar:8.5.3]
	at io.camunda.common.auth.SelfManagedAuthentication.generateToken(SelfManagedAuthentication.java:23) ~[java-common-8.5.3.jar:8.5.3]
	at io.camunda.common.auth.JwtAuthentication.getTokenHeader(JwtAuthentication.java:30) ~[java-common-8.5.3.jar:8.5.3]
	at io.camunda.tasklist.CamundaTaskListClient.authenticate(CamundaTaskListClient.java:532) ~[camunda-tasklist-client-java-8.5.3.6.jar:na]
	at io.camunda.tasklist.CamundaTaskListClient.<init>(CamundaTaskListClient.java:65) ~[camunda-tasklist-client-java-8.5.3.6.jar:na]
	at io.camunda.tasklist.CamundaTaskListClientBuilder.build(CamundaTaskListClientBuilder.java:76) ~[camunda-tasklist-client-java-8.5.3.6.jar:na]
	at com.example.camunda8sample.config.TaskListConfig.camundaTaskListClient(TaskListConfig.java:66) ~[main/:na]
	at com.example.camunda8sample.config.TaskListConfig$$SpringCGLIB$$0.CGLIB$camundaTaskListClient$0(<generated>) ~[main/:na]
	at com.example.camunda8sample.config.TaskListConfig$$SpringCGLIB$$FastClass$$1.invoke(<generated>) ~[main/:na]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) ~[spring-core-6.1.12.jar:6.1.12]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:348) ~[spring-context-6.1.12.jar:6.1.12]
	at com.example.camunda8sample.config.TaskListConfig$$SpringCGLIB$$0.camundaTaskListClient(<generated>) ~[main/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146) ~[spring-beans-6.1.12.jar:6.1.12]

Stack Trace for tasklist-client-java SDK:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.camunda.tasklist.CamundaTaskListClient]: Factory method 'camundaTaskListClient' threw exception with message: request failed with status code '404' and body '{"error":"Unable to find matching target resource method"}'
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:178) ~[spring-beans-6.1.12.jar:6.1.12]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644) ~[spring-beans-6.1.12.jar:6.1.12]
	... 47 common frames omitted
Caused by: io.camunda.identity.sdk.impl.rest.exception.RestException: request failed with status code '404' and body '{"error":"Unable to find matching target resource method"}'
	at io.camunda.identity.sdk.impl.rest.RestClient.send(RestClient.java:123) ~[identity-sdk-8.5.1.jar:8.5.1]
	at io.camunda.identity.sdk.impl.rest.RestClient.request(RestClient.java:105) ~[identity-sdk-8.5.1.jar:8.5.1]
	at io.camunda.identity.sdk.impl.keycloak.KeycloakAuthentication.requestFreshToken(KeycloakAuthentication.java:91) ~[identity-sdk-8.5.1.jar:8.5.1]
	at io.camunda.identity.sdk.authentication.AbstractAuthentication.requestToken(AbstractAuthentication.java:91) ~[identity-sdk-8.5.1.jar:8.5.1]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
	at io.camunda.identity.sdk.annotation.AnnotationProcessor.lambda$apply$0(AnnotationProcessor.java:33) ~[identity-sdk-8.5.1.jar:8.5.1]
	at jdk.proxy2/jdk.proxy2.$Proxy90.requestToken(Unknown Source) ~[na:na]
	at io.camunda.common.auth.SelfManagedAuthentication.getIdentityToken(SelfManagedAuthentication.java:31) ~[java-common-8.5.3.jar:8.5.3]
	at io.camunda.common.auth.SelfManagedAuthentication.generateToken(SelfManagedAuthentication.java:23) ~[java-common-8.5.3.jar:8.5.3]
	at io.camunda.common.auth.JwtAuthentication.getTokenHeader(JwtAuthentication.java:30) ~[java-common-8.5.3.jar:8.5.3]
	at io.camunda.tasklist.CamundaTaskListClient.authenticate(CamundaTaskListClient.java:532) ~[camunda-tasklist-client-java-8.5.3.6.jar:na]
	at io.camunda.tasklist.CamundaTaskListClient.<init>(CamundaTaskListClient.java:65) ~[camunda-tasklist-client-java-8.5.3.6.jar:na]
	at io.camunda.tasklist.CamundaTaskListClientBuilder.build(CamundaTaskListClientBuilder.java:76) ~[camunda-tasklist-client-java-8.5.3.6.jar:na]
	at com.example.camunda8sample.config.TaskListConfig.camundaTaskListClient(TaskListConfig.java:66) ~[main/:na]
	at com.example.camunda8sample.config.TaskListConfig$$SpringCGLIB$$0.CGLIB$camundaTaskListClient$0(<generated>) ~[main/:na]
	at com.example.camunda8sample.config.TaskListConfig$$SpringCGLIB$$FastClass$$1.invoke(<generated>) ~[main/:na]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) ~[spring-core-6.1.12.jar:6.1.12]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:348) ~[spring-context-6.1.12.jar:6.1.12]
	at com.example.camunda8sample.config.TaskListConfig$$SpringCGLIB$$0.camundaTaskListClient(<generated>) ~[main/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146) ~[spring-beans-6.1.12.jar:6.1.12]
	... 48 common frames omitted

Even when i am trying to do the same from keycloak API to generate token for tasklist-api client which is already there token is generated but with that same token i am not able to access tasklist api from v1 swagger.

keycloak Endpoint:

curl --location 'https://example.com/auth/realms/camunda-platform/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=tasklist-api' \
--data-urlencode 'client_secret=xxxxxx' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'scope=openid'
curl --location 'https://example.com/tasklist/v1/tasks/search' \
--header 'accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data '{
  "state": "CREATED"
}'

Stack Trace for tasklist-client-java SDK

It seems that the keycloak url that you configure in the client is not correct, make sure to put the full realm url like http://{keycloak_host}/auth/realms/camunda-platform

Even when i am trying to do the same from keycloak API to generate token for tasklist-api client which is already there token is generated but with that same token i am not able to access tasklist api from v1 swagger.

Make sure that your client api (application) has access to tasklist api like it is explained in Incorporate applications | Camunda 8 Docs
You can also add the audience when you generate the token
--data-urlencode 'audience=tasklist-api'

Hi @houssain-barouni
I have now added the and its not showing up error for tasklist for now but the zeebe is giving error. Can you help with that too.

YML configuration:

zeebe:
  client:
    broker:
      gateway-address: zeebe-grpc.staging-camunda.example.com

and getting the following error:

io.grpc.StatusRuntimeException: UNAUTHENTICATED: Expected bearer token at header with key [authorization], but found nothing
	at io.grpc.Status.asRuntimeException(Status.java:533) ~[grpc-api-1.65.1.jar:1.65.1]
	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:481) ~[grpc-stub-1.65.1.jar:1.65.1]
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:564) ~[grpc-core-1.65.1.jar:1.65.1]
	at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:72) ~[grpc-core-1.65.1.jar:1.65.1]
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:729) ~[grpc-core-1.65.1.jar:1.65.1]
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:710) ~[grpc-core-1.65.1.jar:1.65.1]
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.65.1.jar:1.65.1]
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) ~[grpc-core-1.65.1.jar:1.65.1]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]

you should set these environment variables to your zeebe client
ZEEBE_CLIENT_ID
ZEEBE_CLIENT_SECRET
ZEEBE_TOKEN_AUDIENCE=zeebe-api
ZEEBE_AUTHORIZATION_SERVER_URL=keycloakBaseUrl + /auth/realms/camunda-platform/protocol/openid-connect/token

checkout this documentation Client authorization | Camunda 8 Docs

one more question i have, If we have integrated tasklist client in our service, the main purpose of integrating that is to handle and automate user tasks where we actually require some input from an external service, since tasklist has non production usage for free self managed camunda 8, will we able to automate the tasks in production with free plan, if not is there any other alternative for user task automation where we can wait in process to get inputs from an external service which calls a REST API in out service and resumes the camunda process ?

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