Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

spring-zeebe 8.4.0 with spring-boot 2.7.x generates error Cannot invoke "java.util.Collection.size()" because "c" is null #616

Open
daniel-ewing opened this issue Jan 30, 2024 · 7 comments

Comments

@daniel-ewing
Copy link
Contributor

daniel-ewing commented Jan 30, 2024

Describe the bug

Try to use spring-zeebe 8.4.0 with spring-boot 2.7.x. Add a JobWorker. The log is full of the stacktrace given below and the job worker does not work.

To Reproduce
pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>c8-basic-test</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <spin.version>1.21.0</spin.version>
        <zeebe.starter.version>8.4.0</zeebe.starter.version>
        <spring.version>2.7.7</spring.version>
        <lombok.version>1.18.28</lombok.version>
        <jackson.version>2.15.2</jackson.version>

        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>

            <dependency>
                <groupId>org.camunda.spin</groupId>
                <artifactId>camunda-spin-bom</artifactId>
                <scope>import</scope>
                <type>pom</type>
                <version>${spin.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>io.camunda.spring</groupId>
            <artifactId>spring-boot-starter-camunda</artifactId>
            <version>${zeebe.starter.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.camunda.spin</groupId>
            <artifactId>camunda-spin-dataformat-json-jackson</artifactId>
            <version>${spin.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring.version}</version>
                <configuration>
                    <layout>ZIP</layout>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

job worker

@Component
@Slf4j
public class GetVariables1 {
    @JobWorker(type = "getVariables1")
    public void handleGetVariables1(final JobClient client) {
        String methodName = "handleGetVariables1";

        if (log.isDebugEnabled()) log.debug("-----> {}: Enter", methodName);

        if (log.isDebugEnabled()) log.debug("-----> {}: Exit", methodName);
    }
}

application class

@SpringBootApplication
@EnableZeebeClient
@Slf4j
@Deployment(resources = "classpath*:/bpmn/**/*.bpmn")
public class Application {
    private final ZeebeClient client;

    public Application(ZeebeClient client) {
        this.client = client;
    }

    public static void main(final String... args) {
        SpringApplication.run(Application.class, args);
    }

}

Expected behavior

The Application should run with no errors, job worker should work.

Log/Stacktrace

Full Stacktrace

2024-01-30 14:49:04.311  WARN 16780 --- [pool-1-thread-1] io.camunda.zeebe.client.job.worker       : Unexpected failure to activate jobs

java.lang.NullPointerException: Cannot invoke "java.util.Collection.size()" because "c" is null
	at java.base/java.util.HashSet.<init>(HashSet.java:120) ~[na:na]
	at io.camunda.zeebe.client.impl.command.ActivateJobsCommandImpl.<init>(ActivateJobsCommandImpl.java:66) ~[zeebe-client-java-8.4.0.jar:8.4.0]
	at io.camunda.zeebe.client.impl.worker.JobClientImpl.newActivateJobsCommand(JobClientImpl.java:88) ~[zeebe-client-java-8.4.0.jar:8.4.0]
	at io.camunda.zeebe.client.impl.worker.JobPollerImpl.poll(JobPollerImpl.java:109) ~[zeebe-client-java-8.4.0.jar:8.4.0]
	at io.camunda.zeebe.client.impl.worker.JobPollerImpl.poll(JobPollerImpl.java:98) ~[zeebe-client-java-8.4.0.jar:8.4.0]
	at io.camunda.zeebe.client.impl.worker.JobWorkerImpl.poll(JobWorkerImpl.java:193) ~[zeebe-client-java-8.4.0.jar:8.4.0]
	at io.camunda.zeebe.client.impl.worker.JobWorkerImpl.lambda$tryPoll$0(JobWorkerImpl.java:162) ~[zeebe-client-java-8.4.0.jar:8.4.0]
	at java.base/java.util.Optional.ifPresent(Optional.java:178) ~[na:na]
	at io.camunda.zeebe.client.impl.worker.JobWorkerImpl.tryPoll(JobWorkerImpl.java:159) ~[zeebe-client-java-8.4.0.jar:8.4.0]
	at io.camunda.zeebe.client.impl.worker.JobWorkerImpl.onScheduledPoll(JobWorkerImpl.java:149) ~[zeebe-client-java-8.4.0.jar:8.4.0]
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]

Environment:

  • OS: Windows 10
  • Deployment: SaaS 8.4.1
  • Spring-Zeebe Version: 8.4.0
  • SpringBoot Version: 2.7.7
@JahiruddinSeera
Copy link

@daniel-ewing
Were you able to fix this? It seems something related to default tenant ids but seems a bug.

@daniel-ewing
Copy link
Contributor Author

@JahiruddinSeera
No, I never determined the issue, I switched to a SM cluster to make progress.

@JahiruddinSeera
Copy link

JahiruddinSeera commented Mar 14, 2024

@daniel-ewing
I was able to make it work by downgrading to Spring-Zeebe Version : 8.3.4 if that is not an issue

@daniel-ewing
Copy link
Contributor Author

Hi @JahiruddinSeera,

Yes, that is an issue, please refer to Version compatibility:
image

@zgnikolai
Copy link

Hi @daniel-ewing , but >= 2.7 is not > 2.7 so it should work?

@daniel-ewing
Copy link
Contributor Author

daniel-ewing commented Apr 2, 2024

Hi @zgnikolai, If I understand your question correctly, the answer is 'Yes'. According to the Version compatibility matrix, Camunda 8.4.x should work with Spring Boot 2.7.x. But I cannot get that to work and apparently neither can @JahiruddinSeera.

@zgnikolai
Copy link

zgnikolai commented Apr 3, 2024

Hi @daniel-ewing,

sorry i misunderstood your comment.
I got it working by adding the following to my application.yml

zeebe:
    default-job-worker-tenant-ids:
      - '<default>'

it mimics what i found in the code:
private List<String> defaultJobWorkerTenantIds = Collections.singletonList("<default>");

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants