spring-cloud / spring-cloud/spring-cloud-task

NoSuchMethodError when launch a spring batch worker using DeployerPartitionerHandler on KubernetesDeloyerTaskLaucher

Open
#926 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
446
Forks
310
Avg merge
18h 18m
Merged PRs (30d)
6

Description

I am getting this issue while trying to run the pod worker into kubernetes cluster using DeployerPartitionerHandler with Kubernetes Deployer

java.lang.NoSuchMethodError: 'io.fabric8.kubernetes.api.model.HTTPGetActionFluent io.fabric8.kubernetes.api.model.HTTPGetActionBuilder.withNewPort(java.lang.Integer)'
at org.springframework.cloud.deployer.spi.kubernetes.HttpProbeCreator.create(HttpProbeCreator.java:65) ~[spring-cloud-deployer-kubernetes-2.9.0.jar:na]

In the HTTPGetActionBuilder class there is a function withNewPort(Object port), even though the port 8989 has been populated but it thrown this exception

image

Please find more details of package version:

Spring boot: 3.1.4
Spring Cloud Task: 3.0.3
Spring Cloud Task Batch: 3.0.3
Spring Cloud Deployer: 2.9.0

This is how I configure the partition handler:

@Bean
public DeployerPartitionHandler partitionHandler() {
    Resource resource = new DockerResource("service-image");
    DeployerPartitionHandler partitionHandler = new DeployerPartitionHandler(taskLauncher, jobExplorer, resource, "ingestWorkerStep", taskRepository);
    List<String> commandLineArgs = new ArrayList<>(4);
    commandLineArgs.add("--spring.profiles.active=worker");
    commandLineArgs.add("--spring.cloud.task.initialize.enable=false");
    commandLineArgs.add("--spring.batch.initializer.enabled=false");
    commandLineArgs.add("--spring.datasource.initialize=false");
    commandLineArgs.add("--spring.datasource.initialize=false");
    partitionHandler.setCommandLineArgsProvider(new PassThroughCommandLineArgsProvider(commandLineArgs));
    partitionHandler.setEnvironmentVariablesProvider(new SimpleEnvironmentVariablesProvider(environment));
    partitionHandler.setMaxWorkers(3);
    partitionHandler.setApplicationName("partitionjob");
    return partitionHandler;
}
spring:
  cloud:
    deployer:
      kubernetes:
        namespace: default
        startup-http-probe-port: 8989
        liveness-http-probe-port: 8989
        readiness-http-probe-port: 8989
        host-network: true
        livenessProbePath: /actuator/health/liveness
        readinessProbePath: /actuator/health/readiness

Did I miss any configuration?

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack trace at HttpProbeCreator.java:65 and compare the expected HTTPGetActionBuilder.withNewPort(Integer) method with the configured Spring Boot, Spring Cloud Task, Spring Cloud Task Batch, Spring Cloud Deployer, and Kubernetes versions. Reproduce the worker launch using the shown probe-port configuration and verify that it starts without NoSuchMethodError.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kubernetes, spring, spring-boot
Domain
backend, devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.