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

Resteasy configuration defined in application.properties is ignored since the 3.0 version #38279

Closed
lukasz-piekarski-smartlogic opened this issue Jan 18, 2024 · 6 comments
Labels
area/resteasy kind/bug Something isn't working
Milestone

Comments

@lukasz-piekarski-smartlogic

Describe the bug

Given a quarkus project (version 2.x) with resteasy and servlet features, defining a PATCH endpoint:

@PATCH
    @Consumes("application/merge-patch+json")
    @Produces(MediaType.APPLICATION_JSON)
    public String hello() {
        return "Hello from RESTEasy Reactive";
    }

with resteasy patchfilter disabled in application.properties

resteasy.patchfilter.disabled=true

invoking the endpoint yields the expected results:

$ curl -X PATCH http://localhost:8080/hello -H 'Content-Type: application/merge-patch+json'
Hello from RESTEasy Reactive

But after upgrading quarkus to 3.0

quarkus update --stream=3.0

The resteasy.patchfilter.disabled=true property is no longer respected and invoking the endpoint results in the following error

org.jboss.resteasy.spi.UnhandledException: jakarta.ws.rs.ProcessingException: GET method returns the patch/merge json object target not found    
        at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:357)
        at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:205)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:452)
        at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:240)
        at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:154)
        at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
        at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:157)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:229)
        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:222)
        at io.quarkus.resteasy.runtime.ResteasyFilter.doFilter(ResteasyFilter.java:35)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:63)
        at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
        at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:67)
        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:133)
        at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:65)
        at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
        at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
        at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:247)
        at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:56)
        at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:111)
        at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:108)
        at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
        at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
        at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$9$1.call(UndertowDeploymentRecorder.java:624)
        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
        at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:152)
        at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$1.handleRequest(UndertowDeploymentRecorder.java:124)
        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:284)
        at io.undertow.server.DefaultExchangeHandler.handle(DefaultExchangeHandler.java:18)
        at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$5$2.run(UndertowDeploymentRecorder.java:439)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: jakarta.ws.rs.ProcessingException: GET method returns the patch/merge json object target not found
        at org.jboss.resteasy.plugins.providers.AbstractPatchMethodFilter.getMethodInvoker(AbstractPatchMethodFilter.java:163)
        at org.jboss.resteasy.plugins.providers.AbstractPatchMethodFilter.filter(AbstractPatchMethodFilter.java:101)
        at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:276)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:415)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:378)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:356)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:70)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:429)
        ... 47 more

Expected behavior

resteasy.patchfilter.disabled=true should be respected

Actual behavior

resteasy.patchfilter.disabled=true is ignored and the default patch filter from resteasy overlays the method from the project.

How to Reproduce?

  1. download the demo.zip project
  2. run mvn quarkus:dev
  3. run curl -X PATCH http://localhost:8080/hello -H 'Content-Type: application/merge-patch+json' to see that everything works correctly for quarkus 2.16.12.Final
  4. run quarkus update --stream=3.0 to upgrade the project to quarkus 3.0
  5. run mvn quarkus:dev and curl -X PATCH http://localhost:8080/hello -H 'Content-Type: application/merge-patch+json' again to see that now the exception appears

Output of uname -a or ver

MINGW64_NT-10.0-22621 RDLP 3.3.6-341.x86_64 2022-09-05 20:28 UTC x86_64 Msys

Output of java -version

openjdk version "11.0.18" 2023-01-17 LTS OpenJDK Runtime Environment Microsoft-7208460 (build 11.0.18+10-LTS) OpenJDK 64-Bit Server VM Microsoft-7208460 (build 11.0.18+10-LTS, mixed mode)

Quarkus version or git rev

3.0.4.Final

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

Apache Maven 3.9.0

Additional information

No response

@geoand
Copy link
Contributor

geoand commented Jan 18, 2024

cc @jamezp

@jamezp
Copy link
Contributor

jamezp commented Jan 18, 2024

Looks like a simple fix, see https://issues.redhat.com/browse/RESTEASY-3439.

As a workaround if you pass -Dresteasy.patchfilter.disabled=true as a system property it should work until the bug is fixed. For example:

mvn quarkus:dev -Djvm.args="-Dresteasy.patchfilter.disabled=true"

@geoand
Copy link
Contributor

geoand commented Feb 12, 2024

@jamezp any plans for 6.2.8.Final in the immediate future?

Thanks

@jamezp
Copy link
Contributor

jamezp commented Feb 12, 2024

@geoand Generally I try to do one once a quarter and we did one in January. However, I don't mind doing a release out of cycle. I could probably do one tomorrow, then we could get a version bump in WildFly too.

@geoand
Copy link
Contributor

geoand commented Feb 12, 2024

No hurry, just wondering 😄

@geoand
Copy link
Contributor

geoand commented May 17, 2024

We now include version 6.2.8 of RESTEasy, so I am going to close this.

@geoand geoand closed this as completed May 17, 2024
@geoand geoand added triage/out-of-date This issue/PR is no longer valid or relevant and removed triage/out-of-date This issue/PR is no longer valid or relevant labels May 17, 2024
@geoand geoand added this to the 3.11.0.CR1 milestone May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/resteasy kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants