camunda-community-hub / camunda-tasklist-client-java

Java client for the Tasklist API of Camunda Platform 8
Apache License 2.0
26 stars 16 forks source link

Can not find Product #95

Closed AlexYangYu closed 1 month ago

AlexYangYu commented 1 month ago

backgroud: SpringBoot3.3 + Camund8.5

dependency: implementation group: 'io.camunda.spring', name: 'spring-boot-starter-camunda', version: '8.5.7'

implementation group: 'io.camunda', name: 'camunda-tasklist-client-java', version: '8.5.3.4'

code:

SimpleConfig simpleConf = new SimpleConfig();
simpleConf.addProduct(Product.TASKLIST, new SimpleCredential("user", "pwd", "http://tasklistUrl[:port]"));
Authentication auth = SimpleAuthentication.builder().withSimpleConfig(simpleConf).build();

CamundaTaskListClient client = CamundaTaskListClient.builder()
  .taskListUrl("http://tasklistUrl[:port]")
  .authentication(auth)
  .cookieExpiration(Duration.ofSeconds(5))
  .build();

The above code will prompt that Product cannot be found. How to solve?

chDame commented 1 month ago

Hi @AlexYangYu ,

import io.camunda.common.auth.Product;

rashidRizvi98 commented 1 month ago

I am using keycloak to authenticate in a self managed cluster.

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

For me also it is throwing a compilation error

Caused by: java.lang.NoSuchFieldError: Class io.camunda.common.auth.Product does not have member field 'io.camunda.common.auth.Product TASKLIST'

chDame commented 1 month ago

Could you try adding the identity repository as described here : https://forum.camunda.io/t/the-following-artifacts-could-not-be-resolved-io-camundajar-8-3-1/48486

rashidRizvi98 commented 1 month ago

I am using keycloak to authenticate in a self managed cluster.

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

For me also it is throwing a compilation error

Caused by: java.lang.NoSuchFieldError: Class io.camunda.common.auth.Product does not have member field 'io.camunda.common.auth.Product TASKLIST'

Seems some transitive dependency version mismatch was causing this issue. I was using below dependency(for zeebe) from camunda documentation.

<dependency>
           <groupId>io.camunda</groupId>
           <artifactId>spring-boot-starter-camunda-sdk</artifactId>
           <version>8.5.0</version>
  </dependency> 

After removing it worked