Open thomasdarimont opened 5 months ago
I stumbled about this too, but in my case it was a missing dependency to quarkus-opentelemetry
:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-opentelemetry</artifactId>
</dependency>
Another library enabled access logs and opentelemetry, but I didn't had the dependency in my pom.xml and had the same error. But only in run mode, dev mode had no issues.
@thomasdarimont thanks for the detailed report!
As you have already analyzed the code, would you like to contribute the fix you have in mind?
Describe the bug
When using a custom
http.root-path
together with customhttp.non-application-root-path
andhttp.access-log.enabled=true
starting a quarkus app fails with ajava.lang.NullPointerException
.Example configuration which triggers the problem:
Note that this also happens with ealier quarkus versions. So if this is fixed it would be great to backport this :) (Quarkus 3.8.x maybe? :))
Expected behavior
The app should not fail to start
Actual behavior
The following exception is thrown:
How to Reproduce?
See example in this gist: https://gist.github.com/thomasdarimont/458dd8ce85dd347ddf3c690d61944559
Output of
uname -a
orver
Linux neumann 6.8.7-100.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 17 19:34:28 UTC 2024 x86_64 GNU/Linux
Output of
java -version
openjdk version "22.0.1" 2024-04-16 OpenJDK Runtime Environment Temurin-22.0.1+8 (build 22.0.1+8) OpenJDK 64-Bit Server VM Temurin-22.0.1+8 (build 22.0.1+8, mixed mode, sharing)
Quarkus version or git rev
3.10.0
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.6
Additional information
This is also reproducible with Quarkus 3.8.3 currently used by Keycloak (24.0.3).
The problem is triggered here: https://github.com/quarkusio/quarkus/blob/3.8.3/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java#L471
but I think the cause for this is here: https://github.com/quarkusio/quarkus/blob/3.8.3/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java#L272.
The problem is that the
frameworkRouter
is not initialized, since the check&& route.isRouterFramework()
returnsfalse
for thenon-application-root-path
(the router type errornously set toAPPLICATION
instead ofFRAMEWORK
).If I set the proper Router type with a debugger in
io.quarkus.vertx.http.deployment.RouteBuildItem#isRouterFramework
during augmentation then the application can start fine.