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 (RestResponse<InputStream>) #26780

Closed
manusa opened this issue Jul 18, 2022 · 14 comments · Fixed by #26923
Assignees
Labels
Milestone

Comments

@manusa
Copy link
Contributor

manusa commented Jul 18, 2022

Describe the bug

I'm facing a similar issue to the one described in #25973 fixed by #26021.

In my case the method signature and annotations look like:

  @GET
  @Path("/{fileName:.+}")
  public RestResponse<InputStream> getStaticFile(@PathParam("fileName") String fileName) throws IOException {

Maybe accounting for RestResponse/InputStream in ResteasyReactiveProcessor might fix it 🤷.

I can workaround this issue by annotation the affected class with @RegisterForReflection

Expected behavior

No exception should be thrown, method should pipe an input stream to the response.

Actual behavior

Fails with:

2022-07-18 11:59:15,376 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (executor-thread-0) Request failed: java.lang.RuntimeException: java.lang.NoSuchMethodException: com.example.fullstack.GatewayResource.getFrontendStaticFile(java.lang.String)

How to Reproduce?

https://github.com/marcnuri-demo/202207-quarkus-26780

Output of uname -a or ver

No response

Output of java -version

OpenJDK Runtime Environment Temurin-17.0.1+12 (build 17.0.1+12)

GraalVM version (if different from Java)

  • quay.io/quarkus/ubi-quarkus-mandrel:21.3-java17
  • quay.io/quarkus/ubi-quarkus-mandrel:22.1-java17

Quarkus version or git rev

<=2.10.2.Final

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

No response

Additional information

No response

@manusa manusa added the kind/bug Something isn't working label Jul 18, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 18, 2022

@mihaipoenaru
Copy link

@manusa does it still happen with ubi-quarkus-mandrel:22.1-java17 ? I had similar issues with reflection, but it was solved when I bumped the mandrel version

@manusa
Copy link
Contributor Author

manusa commented Jul 18, 2022

@manusa does it still happen with ubi-quarkus-mandrel:22.1-java17 ? I had similar issues with reflection, but it was solved when I bumped the mandrel version

Let me try it

@manusa
Copy link
Contributor Author

manusa commented Jul 18, 2022

@manusa does it still happen with ubi-quarkus-mandrel:22.1-java17 ? I had similar issues with reflection, but it was solved when I bumped the mandrel version

Let me try it

No luck, same result. I'm inclined to think that this should be fixed at the deployment processor level.

@gsmet
Copy link
Member

gsmet commented Jul 18, 2022

I'm surprised @get is not sufficient to trigger the registration. Could you create a small reproducer?

@mihaipoenaru
Copy link

In the log I see a different name from your method: GatewayResource.getFrontendStaticFile(java.lang.String)

Is it a copy paste mistake, or is it another method somewhere?

@manusa
Copy link
Contributor Author

manusa commented Jul 18, 2022

In the log I see a different name from your method: GatewayResource.getFrontendStaticFile(java.lang.String)

Is it a copy paste mistake, or is it another method somewhere?

I replaced the name in the issue description to remove any confusion, it's the same method (but maybe I created more confusion instead 😅)

@manusa
Copy link
Contributor Author

manusa commented Jul 18, 2022

I'm surprised @get is not sufficient to trigger the registration. Could you create a small reproducer?

👍 I'll try to create one tomorrow and update the description.

manusa added a commit to marcnuri-demo/202207-quarkus-26780 that referenced this issue Jul 19, 2022
@manusa
Copy link
Contributor Author

manusa commented Jul 19, 2022

I created a reproducer project https://github.com/marcnuri-demo/202207-quarkus-26780

The project README.md contains the necessary steps to reproduce the issue.

@gsmet
Copy link
Member

gsmet commented Jul 19, 2022

@geoand I'm not exactly sure how you're supposed to register the methods in RESTEasy Reactive so I'll let you have a look when you're back from sick leave.

@geoand
Copy link
Contributor

geoand commented Jul 19, 2022

They are not automatically registered for reflection, it only happens under certain conditions.

I'll add this to my increasing list of things to do when I get back

@geoand
Copy link
Contributor

geoand commented Jul 26, 2022

#26923 fixes the issue

@manusa
Copy link
Contributor Author

manusa commented Jul 26, 2022

#26923 fixes the issue

Awesome, thx 🙌

@geoand
Copy link
Contributor

geoand commented Jul 26, 2022

🙏🏼

geoand added a commit to geoand/quarkus that referenced this issue Jul 26, 2022
geoand added a commit to geoand/quarkus that referenced this issue Jul 26, 2022
geoand added a commit to geoand/quarkus that referenced this issue Jul 26, 2022
gsmet added a commit that referenced this issue Jul 26, 2022
Ensure that returning an InputStream from RESTEasy Reactive works in native
@quarkus-bot quarkus-bot bot added this to the 2.12 - main milestone Jul 26, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jul 26, 2022
@gsmet gsmet modified the milestones: 2.12 - main, 2.11.1.Final Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants