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

Fury does not work with quarkus-rest in native mode #32

Closed
zhfeng opened this issue Nov 16, 2024 · 5 comments
Closed

Fury does not work with quarkus-rest in native mode #32

zhfeng opened this issue Nov 16, 2024 · 5 comments

Comments

@zhfeng
Copy link
Contributor

zhfeng commented Nov 16, 2024

When we have a integration of fury with quarkus-rest to do (de)serialize by supporting application/fury media type. It have to add a @RegisterForReflection in the JAX-RS resource, otherwise it faill to find such method like the below one in the native mode.

    @POST
    @Path("/test")
    @Produces("application/fury")
    @Consumes("application/fury")
    public Bar testBar(Bar obj) {
        ...
   }

BTW, it works with quarkus-resteasy.

@zhfeng
Copy link
Contributor Author

zhfeng commented Nov 16, 2024

@gastaldi @geoand This is the reproducer https://github.com/zhfeng/fury_reactive_rest_reproducer

./mvwn clean verify -Dnative

It will fail with

2024-11-16 13:30:15,212 INFO  [io.quarkus] (main) code-with-quarkus-app 1.0.0-SNAPSHOT native (powered by Quarkus 3.16.3) started in 0.015s. Listening on: http://0.0.0.0:8081
2024-11-16 13:30:15,212 INFO  [io.quarkus] (main) Profile prod activated. 
2024-11-16 13:30:15,212 INFO  [io.quarkus] (main) Installed features: [cdi, fury, rest, rest-jackson, smallrye-context-propagation, vertx]
2024-11-16 01:30:15 INFO  Fury:160 [main] - Created new fury org.apache.fury.Fury@3d88ce0e
2024-11-16 13:30:16,042 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /test/fury failed, error id: 7e7ecd63-eef3-41a6-9e17-55b58feb1112-1: java.lang.RuntimeException: java.lang.NoSuchMethodException: org.acme.GreetingResource.testBar(org.acme.Bar)
	at org.jboss.resteasy.reactive.server.spi.ResteasyReactiveResourceInfo.getMethod(ResteasyReactiveResourceInfo.java:84)
	at org.jboss.resteasy.reactive.server.spi.ResteasyReactiveResourceInfo.getParameterAnnotations(ResteasyReactiveResourceInfo.java:125)
	at org.jboss.resteasy.reactive.server.handlers.RequestDeserializeHandler.getAnnotations(RequestDeserializeHandler.java:133)
	at org.jboss.resteasy.reactive.server.handlers.RequestDeserializeHandler.isReadable(RequestDeserializeHandler.java:118)
	at org.jboss.resteasy.reactive.server.handlers.RequestDeserializeHandler.handle(RequestDeserializeHandler.java:78)
	at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:135)
	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:627)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
	at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at [email protected]/java.lang.Thread.runWith(Thread.java:1596)
	at [email protected]/java.lang.Thread.run(Thread.java:1583)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:896)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:872)
Caused by: java.lang.NoSuchMethodException: org.acme.GreetingResource.testBar(org.acme.Bar)
	at [email protected]/java.lang.Class.checkMethod(DynamicHub.java:1078)
	at [email protected]/java.lang.Class.getMethod(DynamicHub.java:1063)
	at org.jboss.resteasy.reactive.server.spi.ResteasyReactiveResourceInfo.getMethod(ResteasyReactiveResourceInfo.java:79)
	... 18 more

There are two test methods for testing application/json and application/fury. It only fails when testing with application/fury.

@geoand
Copy link

geoand commented Nov 21, 2024

Thanks, I'll check next week

@geoand
Copy link

geoand commented Nov 25, 2024

@zhfeng one way to fix this would be for FurySerializer to implement ServerMessageBodyReader and ServerMessageBodyWriter instead of the standard MessageBodyReader and MessageBodyWriter

@zhfeng
Copy link
Contributor Author

zhfeng commented Nov 25, 2024

Thanks @geoand - Is there any difference between these interfaces?

@geoand
Copy link

geoand commented Nov 25, 2024

The difference in this specific case is that Quarkus doesn't have to perform reflection on the JAX-RS / Jakarta REST method just to serialize/deseriaze

zhfeng added a commit to zhfeng/quarkus-fury that referenced this issue Nov 25, 2024
… ServerMessageBodyReader and SeverMessageBodyWriter
@zhfeng zhfeng closed this as completed in b81e312 Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants