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

smallrye-restclient does not throw correct error #2590

Closed
barata0 opened this issue May 24, 2019 · 7 comments
Closed

smallrye-restclient does not throw correct error #2590

barata0 opened this issue May 24, 2019 · 7 comments
Labels
area/rest-client kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant

Comments

@barata0
Copy link
Contributor

barata0 commented May 24, 2019

Hi,

Describe the bug
When RestClient gets a code > 400 it is raising an strange error making impossible to identify if its denied, server error, forbidden, etc...

Expected behavior
Should raise the error: javax.ws.rs.WebApplicationException or an subclass of it e.g (NotAuthorizedException)

Actual behavior
The actual error is: java.lang.RuntimeException: method call not supported

To Reproduce
Just create a rest client calling a denied service

@Path("app")
@RegisterRestClient
public interface AppService {
    @GET
    @Path("PATH_TO_A_DENIED_SERVICE")
    public String deny();
}

Make sure app/PATH_TO_A_DENIED_SERVICE returns status 401

Configuration
app.properties:

my.AppService/mp-rest/url=http://localhost:8080

Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver: Linux precision 4.15.0-50-generic Introduce OpenShift verification #54-Ubuntu SMP Mon May 6 18:46:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

  • Output of java -version openjdk version "11.0.2" 2019-01-15:

  • GraalVM version (if different from Java): Not applyed

  • Quarkus version: 0.15.0

Additional context
Running with the command mvn clean compile quarkus:dev

Bellow is the full stacktrace:


java.lang.RuntimeException: method call not supported
	at io.smallrye.restclient.PartialResponse.notSupported(PartialResponse.java:72)
	at io.smallrye.restclient.PartialResponse.getEntity(PartialResponse.java:68)
	at org.jboss.resteasy.core.ExceptionHandler.unwrapException(ExceptionHandler.java:175)
	at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:104)
	at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:372)
	at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:209)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496)
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:252)
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:153)
	at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:362)
	at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:156)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:238)
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:234)
	at io.quarkus.resteasy.runtime.ResteasyFilter$ResteasyResponseWrapper.sendError(ResteasyFilter.java:72)
	at io.undertow.servlet.handlers.DefaultServlet.doGet(DefaultServlet.java:175)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:686)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:791)
	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
	at io.quarkus.resteasy.runtime.ResteasyFilter.doFilter(ResteasyFilter.java:43)
	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:62)
	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.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
	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:64)
	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.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:292)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
	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.UndertowDeploymentTemplate$7$1$1.call(UndertowDeploymentTemplate.java:437)
	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
	at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:197)
	at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65)
	at io.quarkus.undertow.runtime.UndertowDeploymentTemplate$1.handleRequest(UndertowDeploymentTemplate.java:96)
	at io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49)
	at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup.handleHotDeploymentRequest(UndertowHotReplacementSetup.java:80)
	at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup$1$1.handleRequest(UndertowHotReplacementSetup.java:51)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1538)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1429)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:32)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at org.jboss.threads.JBossThread.run(JBossThread.java:479)
@barata0 barata0 added the kind/bug Something isn't working label May 24, 2019
@gsmet gsmet changed the title smallrye-restclient does not throws correct error smallrye-restclient does not throw correct error May 30, 2019
@gsmet
Copy link
Member

gsmet commented May 30, 2019

@barata0 any chance you could prepare a real reproducer (a very simple Maven project would be ideal)?

@gsmet gsmet added this to the 0.17.0 milestone May 30, 2019
@gsmet
Copy link
Member

gsmet commented May 30, 2019

It might be related to: smallrye/smallrye-rest-client#11 .

@barata0
Copy link
Contributor Author

barata0 commented May 31, 2019

@gsmet I believe it's the same problem indeed.

Here it is github project

https://github.com/barata0/quarkus-rest-client-401

@gsmet gsmet removed this from the 0.17.0 milestone Jun 18, 2019
@gsmet
Copy link
Member

gsmet commented Jun 18, 2019

Unfortunately, given what @kenfinnigan said in the SmallRye REST client issue, I don't know when this will be fixed.

@kenfinnigan can you check that the issue reported to SmallRye REST client has been integrated in the RESTEasy roadmap. It seems to be a pretty annoying issue.

Thanks!

@kenfinnigan
Copy link
Member

@sberyozkin Can you link which RESTEasy issue you were referring to in smallrye/smallrye-rest-client#11 and then we can determine whether that would be part of a release of RESTEasy that would include the REST Client?

@barata0
Copy link
Contributor Author

barata0 commented Oct 1, 2019

Hi,

I just tested on quarkus 23.1 and it seems to be working fine.
I don´t know exaclty on which version it was fixed but thanks!

@barata0 barata0 closed this as completed Oct 1, 2019
@gsmet gsmet added the triage/out-of-date This issue/PR is no longer valid or relevant label Oct 8, 2019
@gsmet
Copy link
Member

gsmet commented Oct 8, 2019

@barata0 thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest-client kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant
Projects
None yet
Development

No branches or pull requests

3 participants