https://github.com/khauser/spring-classpath-problem
In this project I get the following stacktrace:
java.io.FileNotFoundException: class path resource [scripts/helm_list_script.sh] cannot be opened because it does not exist
\tat org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:211)
\tat com.intershop.iste.kubernetes.command.CommandExecutor.executeFile(CommandExecutor.java:139)
\tat com.intershop.iste.kubernetes.service.HelmService.executeHelmChartListScript(HelmService.java:258)
\tat com.intershop.iste.kubernetes.service.KubernetesService.helmChartList(KubernetesService.java:291)
\tat com.intershop.iste.kubernetes.controller.KubernetesServiceController.lambda$helmChartList$0(KubernetesServiceController.java:60)
\tat java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
\tat java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
\tat java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
\tat java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
\tat java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
\tat java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
\tat java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Without the usage of the CompletableFuture or when replacing resourceLoader.getResource(scriptName + ".sh") with this.getClass().getClassLoader().getResourceAsStream the GET request succeeds.
I tested this (there is a Dockerfile) with eclipse-temurin:17.0.8_7-jre-alpine and eclipse-temurin:17.0.3_7-jre-alpine and spring boot 3.1.2.
Comment From: wilkinsona
Duplicates https://github.com/spring-projects/spring-boot/issues/19427.