Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Boot properties app throws NPE when endpoint accessed since Quarkus 3.18.1 #46341

Closed
rsvoboda opened this issue Feb 18, 2025 · 5 comments · Fixed by #46359
Closed

Spring Boot properties app throws NPE when endpoint accessed since Quarkus 3.18.1 #46341

rsvoboda opened this issue Feb 18, 2025 · 5 comments · Fixed by #46359
Assignees
Labels
area/config area/native-image area/spring Issues relating to the Spring integration kind/bug Something isn't working
Milestone

Comments

@rsvoboda
Copy link
Member

rsvoboda commented Feb 18, 2025

Describe the bug

Spring Boot properties app throws NPE when endpoint accessed since Quarkus 3.18.1

This issue was noticed by experiments after #46172 was fixed
So to reproduce this issue one needs to use explicitly 3.18.1 or the latest main. 3.18.2 and 3.18.3 can't be used because of #46172 issue which applies to 3.18.2+

Expected behavior

Application starts in native and provides the same content as in JVM mode.

Actual behavior

Application starts in native but provides NPE when endpoint is accessed

2025-02-18 16:56:21,363 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /collections/list/strings failed, error id: a7a8db78-577d-4992-aa8e-966d7a834da4-1: java.lang.NullPointerException
	at java.base@21.0.5/java.util.Objects.requireNonNull(Objects.java:233)
	at java.base@21.0.5/java.lang.String.join(String.java:3571)
	at Controller.listOfStrings(Controller.java:16)
	at Controller$quarkusrestinvoker$listOfStrings_f0a20cd7878bec0bdf406f2d32316e49afe9de50.invoke(Unknown Source)
	at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
	at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:638)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
	at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base@21.0.5/java.lang.Thread.runWith(Thread.java:1596)
	at java.base@21.0.5/java.lang.Thread.run(Thread.java:1583)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:896)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:872)

How to Reproduce?

quarkus create app -x=spring-boot-properties,spring-web,rest-jackson
cd code-with-quarkus/
cat << 'EOF' > ./src/main/java/Props.java
import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties("lists")
public class Props {
    public List<String> strings;
}
EOF
cat << 'EOF' > ./src/main/java/Controller.java
import jakarta.inject.Inject;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/collections")
public class Controller {

    @Inject // Using `@Inject` instead of `@Autowired` to verify we can use both.
    Props listProperties;

    @GetMapping("/list/strings")
    public String listOfStrings() {
        return String.join(", ", listProperties.strings);
    }
}
EOF
echo "lists.strings[0]=Value 1" > src/main/resources/application.properties

# success
mvn clean package
java -jar target/quarkus-app/quarkus-run.jar
curl -v http://localhost:8080/collections/list/strings

# failure
mvn clean package -Dnative -Dquarkus.platform.group-id=io.quarkus -Dquarkus.platform.version=999-SNAPSHOT
target/code-with-quarkus-1.0.0-SNAPSHOT-runner
curl -v http://localhost:8080/collections/list/strings

Output of uname -a or ver

macOS 15.3.1

Output of java -version

Java 21

Mandrel or GraalVM version (if different from Java)

23.1.5.r21-mandrel

Quarkus version or git rev

3.18.1 or the latest main

Build tool (ie. output of mvnw --version or gradlew --version)

Maven 3.9.8

Additional information

No response

@rsvoboda rsvoboda added area/native-image kind/bug Something isn't working labels Feb 18, 2025
@quarkus-bot quarkus-bot bot added the area/spring Issues relating to the Spring integration label Feb 18, 2025
Copy link

quarkus-bot bot commented Feb 18, 2025

/cc @Karm (native-image), @aureamunoz (spring), @galderz (native-image), @geoand (spring), @zakkak (native-image)

@geoand
Copy link
Contributor

geoand commented Feb 18, 2025

cc @radcortez

@gsmet
Copy link
Member

gsmet commented Feb 18, 2025

@rsvoboda it's also failing with main?

@radcortez
Copy link
Member

I'll have a look.

@rsvoboda
Copy link
Member Author

@rsvoboda it's also failing with main?

yes, Quarkus version or git rev: 3.18.1 or the latest main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config area/native-image area/spring Issues relating to the Spring integration kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants