quarkus: Link.fromMethod does not take class' @Path into account
Describe the bug (original)
Using Builder fromMethod(Class<?> resource, String method) of the class javax.ws.rs.core.Link in a RESTEasy Reactive resource for constructing a link throws a Request failed: java.lang.IllegalArgumentException: No public method annotated with @Path when compiled natively even when the referenced method exists. Non-natively (and also in earlier Quarkus versions e.g. 2.15.x.Final when compiled natively) this worked without problems.
Expected behavior
Same behavior for non-natively and natively compiled code: Return the correct link.
Actual behavior
See bug description.
How to Reproduce?
- Download the zip file and extract
- Run
./mvnw quarkus:devinside the extracted directory curl -i -X POST http://localhost:8080/rootreturns the expected object with a setLocation:header (although for some reason the base URL is missing, anyway)- Compile natively:
./mvnw package -Dnative - Run
target/no-annotated-method-1.0.0-SNAPSHOT-runner curl -i -X POST http://localhost:8080/rootreturns a HTTP 500 withjava.lang.IllegalArgumentException: No public method annotated with @Path org.acme.MyResource get
Output of uname -a or ver
Linux victoria 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux
Output of java -version
openjdk version “11.0.16” 2022-07-19 OpenJDK Runtime Environment GraalVM CE 22.2.0 (build 11.0.16+8-jvmci-22.2-b06) OpenJDK 64-Bit Server VM GraalVM CE 22.2.0 (build 11.0.16+8-jvmci-22.2-b06, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.16.5.Final
Build tool (ie. output of mvnw --version or gradlew --version)
mvnw 3.8.6
Additional information
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (15 by maintainers)
Indeed, it seems pointless to me, but that’s just my opinion…
Yeah, I am looking at the Jakarta 10 version 😃
That sounds like a bug. Let me reopen the issue and adjust the title
In RESTEasy Reactive we intentionally do not register JAX-RS Resource Classes for reflection (unless we know it’s needed) in order to improve the native-image runtime characteristics.
In this case, Quarkus dow not know that reflection is needed, so you need to manually add
@RegisterForReflectionon the Resource Class.