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

NoSuchMethodException in Resteasy-reactive when running in native mode #25973

Closed
fedinskiy opened this issue Jun 6, 2022 · 4 comments · Fixed by #26021
Closed

NoSuchMethodException in Resteasy-reactive when running in native mode #25973

fedinskiy opened this issue Jun 6, 2022 · 4 comments · Fixed by #26021
Labels
area/rest kind/bug Something isn't working
Milestone

Comments

@fedinskiy
Copy link
Contributor

Describe the bug

I have a sample of code, which runs successfully with Quarkus 2.7(including 2.7.6), but fails with NoSuchMethodException when running with Quarkus 2.8 and beyond in native mode.
The method in question has a signature like that:

    @POST
    @Path("/upload")
    public Uni<String> upload(File body)

Expected behavior

The code should either work or fail with errors/warning, which describe, what is happening.

Actual behavior

An error:

11:41:13,380 INFO  [app] 11:41:12,362 HTTP Request to /file/upload failed, error id: d4b4d067-51d9-489f-aa9d-4a7808e36266-1: java.lang.RuntimeException: java.lang.NoSuchMethodException: io.quarkus.ts.http.restclient.reactive.files.FileResource.upload(java.io.File)
11:41:13,380 INFO  [app] 	at org.jboss.resteasy.reactive.server.spi.ResteasyReactiveResourceInfo.getMethod(ResteasyReactiveResourceInfo.java:65)
11:41:13,380 INFO  [app] 	at org.jboss.resteasy.reactive.server.spi.ResteasyReactiveResourceInfo.getParameterAnnotations(ResteasyReactiveResourceInfo.java:106)
11:41:13,381 INFO  [app] 	at org.jboss.resteasy.reactive.server.handlers.RequestDeserializeHandler.getAnnotations(RequestDeserializeHandler.java:115)
11:41:13,381 INFO  [app] 	at org.jboss.resteasy.reactive.server.handlers.RequestDeserializeHandler.isReadable(RequestDeserializeHandler.java:101)
11:41:13,381 INFO  [app] 	at org.jboss.resteasy.reactive.server.handlers.RequestDeserializeHandler.handle(RequestDeserializeHandler.java:62)
11:41:13,382 INFO  [app] 	at org.jboss.resteasy.reactive.server.handlers.RequestDeserializeHandler.handle(RequestDeserializeHandler.java:25)
11:41:13,382 INFO  [app] 	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:141)
11:41:13,382 INFO  [app] 	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:548)
11:41:13,383 INFO  [app] 	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
11:41:13,383 INFO  [app] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
11:41:13,383 INFO  [app] 	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
11:41:13,383 INFO  [app] 	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
11:41:13,384 INFO  [app] 	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
11:41:13,384 INFO  [app] 	at java.lang.Thread.run(Thread.java:829)
11:41:13,385 INFO  [app] 	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:600)
11:41:13,385 INFO  [app] 	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
11:41:13,385 INFO  [app] Caused by: java.lang.NoSuchMethodException: io.quarkus.ts.http.restclient.reactive.files.FileResource.upload(java.io.File)
11:41:13,386 INFO  [app] 	at java.lang.Class.getMethod(DynamicHub.java:1152)
11:41:13,386 INFO  [app] 	at org.jboss.resteasy.reactive.server.spi.ResteasyReactiveResourceInfo.getMethod(ResteasyReactiveResourceInfo.java:60)
11:41:13,386 INFO  [app] 	... 15 more
11:41:13,386 INFO  [app] 11:41:12,362 Request failed: java.lang.RuntimeException: java.lang.NoSuchMethodException: io.quarkus.ts.http.restclient.reactive.files.FileResource.upload(java.io.File)
11:41:13,387 INFO  [app] 	at org.jboss.resteasy.reactive.server.spi.ResteasyReactiveResourceInfo.getMethod(ResteasyReactiveResourceInfo.java:65)
11:41:13,387 INFO  [app] 	at org.jboss.resteasy.reactive.server.spi.ResteasyReactiveResourceInfo.getParameterAnnotations(ResteasyReactiveResourceInfo.java:106)
11:41:13,387 INFO  [app] 	at org.jboss.resteasy.reactive.server.handlers.RequestDeserializeHandler.getAnnotations(RequestDeserializeHandler.java:115)
11:41:13,388 INFO  [app] 	at org.jboss.resteasy.reactive.server.handlers.RequestDeserializeHandler.isReadable(RequestDeserializeHandler.java:101)
11:41:13,388 INFO  [app] 	at org.jboss.resteasy.reactive.server.handlers.RequestDeserializeHandler.handle(RequestDeserializeHandler.java:62)
11:41:13,388 INFO  [app] 	at org.jboss.resteasy.reactive.server.handlers.RequestDeserializeHandler.handle(RequestDeserializeHandler.java:25)
11:41:13,388 INFO  [app] 	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:141)
11:41:13,389 INFO  [app] 	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:548)
11:41:13,389 INFO  [app] 	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
11:41:13,389 INFO  [app] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
11:41:13,390 INFO  [app] 	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
11:41:13,390 INFO  [app] 	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
11:41:13,390 INFO  [app] 	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
11:41:13,390 INFO  [app] 	at java.lang.Thread.run(Thread.java:829)
11:41:13,391 INFO  [app] 	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:600)
11:41:13,391 INFO  [app] 	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
11:41:13,391 INFO  [app] Caused by: java.lang.NoSuchMethodException: io.quarkus.ts.http.restclient.reactive.files.FileResource.upload(java.io.File)
11:41:13,392 INFO  [app] 	at java.lang.Class.getMethod(DynamicHub.java:1152)
11:41:13,392 INFO  [app] 	at org.jboss.resteasy.reactive.server.spi.ResteasyReactiveResourceInfo.getMethod(ResteasyReactiveResourceInfo.java:60)
11:41:13,392 INFO  [app] 	... 15 more

How to Reproduce?

  1. git clone [email protected]:fedinskiy/quarkus-test-suite.git -b reproducer/no-such-method
  2. cd quarkus-test-suite/http/rest-client-reactive/
  3. mvn clean verify -Dnative -Dit.test=LargeFileHandlingIT#uploadFileThroughClient -Dquarkus.platform.version=2.9.2.Final. Any version, from 2.8.0.CR1 up to 999-SNAPSHOT will suffice and the test will fail.
    Removing the -Dnative option, using version 2.7.6.Final or running any other test will lead to successfull run.

Output of uname -a or ver

5.17.11-300.fc36.x86_64

Output of java -version

11.0.12, vendor: GraalVM Community

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.9.2.Final

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

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)

Additional information

No response

@fedinskiy fedinskiy added the kind/bug Something isn't working label Jun 6, 2022
@quarkus-bot quarkus-bot bot added the area/rest label Jun 6, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jun 6, 2022

/cc @FroMage, @geoand, @stuartwdouglas

@geoand
Copy link
Contributor

geoand commented Jun 6, 2022

Can you attach an example please?

Thanks

@geoand geoand added the triage/needs-reproducer We are waiting for a reproducer. label Jun 6, 2022
@fedinskiy
Copy link
Contributor Author

@geoand I assumed, that the link in the reproducer section is enough[1]. Do you prefer a link to GitHub UI[2]?

[1] git clone [email protected]:fedinskiy/quarkus-test-suite.git -b reproducer/no-such-method
[2] https://github.com/fedinskiy/quarkus-test-suite/tree/reproducer/no-such-method

@geoand
Copy link
Contributor

geoand commented Jun 6, 2022

Great, thanks

@geoand geoand removed the triage/needs-reproducer We are waiting for a reproducer. label Jun 6, 2022
Sgitario added a commit to Sgitario/quarkus that referenced this issue Jun 8, 2022
When having the following resource:

```java
@post
    @consumes(MediaType.APPLICATION_OCTET_STREAM)
    public String update(File file) {
      // ..
    }
```

This works fine when running on JVM, but not in Native where fails with a NoSuchMethodException exception.

To fix this issue, I've registered all the resource classes (the ones annotated with `@ApplicationPath` and `@Path`) for reflection usage. 

In addition to this change:
- I removed some unused methods and fields from the resteasy reactive processor
- I added some coverage of the getting started resteasy reactive client (I also reproduced this issue in this test).

Fix quarkusio#25973
geoand added a commit that referenced this issue Jun 9, 2022
Ensure that File is properly handled in native mode in RESTEasy Reactive
@quarkus-bot quarkus-bot bot added this to the 2.11 - main milestone Jun 9, 2022
@gsmet gsmet modified the milestones: 2.11 - main, 2.10.0.Final Jun 13, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jun 13, 2022
@gsmet gsmet modified the milestones: 2.10.0.Final, 2.7.7.Final Jan 13, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jan 13, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/bug Something isn't working
Projects
None yet
3 participants