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

Quarkus reports a NoSuchMethod hiding the real cause when it fails to start #45676

Closed
ia3andy opened this issue Jan 17, 2025 · 5 comments · Fixed by #45677
Closed

Quarkus reports a NoSuchMethod hiding the real cause when it fails to start #45676

ia3andy opened this issue Jan 17, 2025 · 5 comments · Fixed by #45677
Labels
area/core kind/bug Something isn't working
Milestone

Comments

@ia3andy
Copy link
Contributor

ia3andy commented Jan 17, 2025

Describe the bug

Quarkus reports a NoSuchMethod hiding the real cause when it fails to start.

2025-01-17 10:05:30,287 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to recover after failed start: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoSuchMethodException: java.util.OptionalInt.<init>()
	at io.quarkus.vertx.http.runtime.VertxHttpRecorder.startServerAfterFailedStart(VertxHttpRecorder.java:308)
	at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup.handleFailedInitialStart(VertxHttpHotReplacementSetup.java:73)
	at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.startupFailed(RuntimeUpdatesProcessor.java:1299)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:126)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:428)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:55)
	at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
	at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
	at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
	at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoSuchMethodException: java.util.OptionalInt.<init>()
	at io.quarkus.runtime.configuration.ConfigInstantiator.handleObject(ConfigInstantiator.java:139)
	at io.quarkus.runtime.configuration.ConfigInstantiator.handleObject(ConfigInstantiator.java:78)
	at io.quarkus.runtime.configuration.ConfigInstantiator.handleObject(ConfigInstantiator.java:57)
	at io.quarkus.vertx.http.runtime.VertxHttpRecorder.startServerAfterFailedStart(VertxHttpRecorder.java:277)
	... 9 more
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: java.util.OptionalInt.<init>()
	at io.quarkus.runtime.configuration.ConfigInstantiator.handleObject(ConfigInstantiator.java:139)
	at io.quarkus.runtime.configuration.ConfigInstantiator.handleMap(ConfigInstantiator.java:178)
	at io.quarkus.runtime.configuration.ConfigInstantiator.handleObject(ConfigInstantiator.java:121)
	... 12 more
Caused by: java.lang.NoSuchMethodException: java.util.OptionalInt.<init>()
	at java.base/java.lang.Class.getConstructor0(Class.java:3833)
	at java.base/java.lang.Class.getConstructor(Class.java:2501)
	at io.quarkus.runtime.configuration.ConfigInstantiator.handleObject(ConfigInstantiator.java:106)
	... 14 more

This only happens when using this in the config:

%dev.quarkus.http.static-resources.caching-enabled=false
%dev.quarkus.http.filter.static.header."Cache-Control"=no-cache
%dev.quarkus.http.filter.static.matches=/static/bundle/.+
%dev.quarkus.http.filter.static.methods=GET

I am not sure why it doesn't happen when there is no initial error.

It is causes by:
https://github.com/quarkusio/quarkus/blob/main/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FilterConfig.java#L37
(public java.util.OptionalInt io.quarkus.vertx.http.runtime.FilterConfig.order)

Expected behavior

Should show the real issue

Actual behavior

Show the wrong issue

How to Reproduce?

quarkus dev on:
https://github.com/ia3andy/reproducer-nsm.git

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.17.7

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

No response

Additional information

No response

@ia3andy ia3andy added the kind/bug Something isn't working label Jan 17, 2025
@geoand
Copy link
Contributor

geoand commented Jan 17, 2025

I'll have a look at this later

@gsmet
Copy link
Member

gsmet commented Jan 17, 2025

There is a very simple fix, I have a PR ready.

Now it might need more thinking from @radcortez but I'm not sure it's worth it as I wonder if this might go away with the switch to @ConfigMapping.

@gsmet
Copy link
Member

gsmet commented Jan 17, 2025

This should fix the immediate issue: #45677 and is backportable.

I will let @radcortez comment as to if something more is needed in this area or if we can let this code die slowly :).

@radcortez
Copy link
Member

There is a very simple fix, I have a PR ready.

Now it might need more thinking from @radcortez but I'm not sure it's worth it as I wonder if this might go away with the switch to @ConfigMapping.

Yes, let it die :)

Copy link

quarkus-bot bot commented Jan 17, 2025

/cc @Sanne (core), @aloubyansky (core), @stuartwdouglas (core)

@gsmet gsmet closed this as completed in 6adfaff Jan 17, 2025
@quarkus-bot quarkus-bot bot added this to the 3.19 - main milestone Jan 17, 2025
@gsmet gsmet modified the milestones: 3.19 - main, 3.18.0 Jan 21, 2025
gsmet added a commit to gsmet/quarkus that referenced this issue Jan 21, 2025
@gsmet gsmet modified the milestones: 3.18.0, 3.17.8 Jan 21, 2025
gsmet added a commit to gsmet/quarkus that referenced this issue Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants