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

RestClient does not work if helidon-microprofile-rest-client is declared before helidon-microprofile #8887

Open
romain-grecourt opened this issue Jun 14, 2024 · 0 comments · May be fixed by #9288
Assignees
Labels
4.x Version 4.x bug Something isn't working MP P2 rest-client

Comments

@romain-grecourt
Copy link
Contributor

romain-grecourt commented Jun 14, 2024

Environment Details

  • Helidon Version: 4.0.10
  • Helidon MP

Problem Description

RestClient does not work if io.helidon.microprofile.rest-client:helidon-microprofile-rest-client is declared before io.helidon.microprofile.bundles:helidon-microprofile in pom.xml.

I.e. There is something sensitive to the class-path ordering going on.

Steps to reproduce

Update tests/integration/rest-client/pom.xml as follows:

<dependency>
    <groupId>io.helidon.microprofile.rest-client</groupId>
    <artifactId>helidon-microprofile-rest-client</artifactId>
</dependency>
<dependency>
    <groupId>io.helidon.microprofile.bundles</groupId>
    <artifactId>helidon-microprofile</artifactId>
    <exclusions>
        <exclusion>
            <groupId>io.helidon.microprofile</groupId>
            <artifactId>helidon-microprofile-fault-tolerance</artifactId>
        </exclusion>
    </exclusions>
</dependency>
mvn clean install

target/surefire-reports/io.helidon.tests.integration.restclient.MainTest-output.txt:

MultiException stack 1 of 3
org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available in __HK2_Generated_0 for injection at SystemInjecteeImpl(requiredType=GreetResourceClient,parent=GreetResourceProxy,qualifiers={@org.eclipse.microprofile.rest.client.inject.RestClient()},position=-1,optional=false,self=false,unqualified=null,240807355)
        at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:52)
        at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:197)
        at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:234)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:387)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:466)
        at org.glassfish.jersey.inject.hk2.RequestContext.findOrCreate(RequestContext.java:59)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2109)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:769)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:732)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:702)
        at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getInstance(AbstractHk2InjectionManager.java:160)
        at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getInstance(ImmediateHk2InjectionManager.java:30)
        at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:122)
        at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:260)
        at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:51)
        at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:86)
        at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
        at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
        at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
        at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:69)
        at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:38)
        at org.glassfish.jersey.process.internal.Stages.process(Stages.java:173)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:266)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:266)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:253)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:696)
        at io.helidon.microprofile.server.JaxRsService.doHandle(JaxRsService.java:228)
        at io.helidon.microprofile.server.JaxRsService.lambda$handle$2(JaxRsService.java:185)
        at io.helidon.common.context.Contexts.runInContext(Contexts.java:117)
        at io.helidon.microprofile.server.JaxRsService.handle(JaxRsService.java:185)
        at io.helidon.webserver.http.HttpRoutingImpl$RoutingExecutor.doRoute(HttpRoutingImpl.java:165)
        at io.helidon.webserver.http.HttpRoutingImpl$RoutingExecutor.call(HttpRoutingImpl.java:124)
        at io.helidon.webserver.http.HttpRoutingImpl$RoutingExecutor.call(HttpRoutingImpl.java:102)
        at io.helidon.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:75)
        at io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:121)
        at io.helidon.webserver.observe.metrics.MetricsFeature.lambda$configureVendorMetrics$2(MetricsFeature.java:90)
        at io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:119)
        at io.helidon.common.context.Contexts.runInContext(Contexts.java:117)
        at io.helidon.webserver.context.ContextRoutingFeature.filter(ContextRoutingFeature.java:50)
        at io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:119)
        at io.helidon.webserver.http.Filters.executeFilters(Filters.java:87)
        at io.helidon.webserver.http.Filters.lambda$filter$0(Filters.java:83)
        at io.helidon.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:75)
        at io.helidon.webserver.http.Filters.filter(Filters.java:83)
        at io.helidon.webserver.http.HttpRoutingImpl.route(HttpRoutingImpl.java:73)
        at io.helidon.webserver.http1.Http1Connection.route(Http1Connection.java:357)
        at io.helidon.webserver.http1.Http1Connection.handle(Http1Connection.java:194)
        at io.helidon.webserver.ConnectionHandler.run(ConnectionHandler.java:165)
        at io.helidon.common.task.InterruptableTask.call(InterruptableTask.java:47)
        at io.helidon.webserver.ThreadPerTaskExecutor$ThreadBoundFuture.run(ThreadPerTaskExecutor.java:239)
        at java.base/java.lang.VirtualThread.run(VirtualThread.java:309)
MultiException stack 2 of 3
java.lang.IllegalArgumentException: While attempting to resolve the dependencies of io.helidon.tests.integration.restclient.GreetResourceProxy errors were found
        at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:247)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:387)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:466)
        at org.glassfish.jersey.inject.hk2.RequestContext.findOrCreate(RequestContext.java:59)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2109)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:769)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:732)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:702)
        at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getInstance(AbstractHk2InjectionManager.java:160)
        at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getInstance(ImmediateHk2InjectionManager.java:30)
        at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:122)
        at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:260)
        at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:51)
        at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:86)
        at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
        at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
        at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
        at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:69)
        at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:38)
        at org.glassfish.jersey.process.internal.Stages.process(Stages.java:173)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:266)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:266)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:253)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:696)
        at io.helidon.microprofile.server.JaxRsService.doHandle(JaxRsService.java:228)
        at io.helidon.microprofile.server.JaxRsService.lambda$handle$2(JaxRsService.java:185)
        at io.helidon.common.context.Contexts.runInContext(Contexts.java:117)
        at io.helidon.microprofile.server.JaxRsService.handle(JaxRsService.java:185)
        at io.helidon.webserver.http.HttpRoutingImpl$RoutingExecutor.doRoute(HttpRoutingImpl.java:165)
        at io.helidon.webserver.http.HttpRoutingImpl$RoutingExecutor.call(HttpRoutingImpl.java:124)
        at io.helidon.webserver.http.HttpRoutingImpl$RoutingExecutor.call(HttpRoutingImpl.java:102)
        at io.helidon.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:75)
        at io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:121)
        at io.helidon.webserver.observe.metrics.MetricsFeature.lambda$configureVendorMetrics$2(MetricsFeature.java:90)
        at io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:119)
        at io.helidon.common.context.Contexts.runInContext(Contexts.java:117)
        at io.helidon.webserver.context.ContextRoutingFeature.filter(ContextRoutingFeature.java:50)
        at io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:119)
        at io.helidon.webserver.http.Filters.executeFilters(Filters.java:87)
        at io.helidon.webserver.http.Filters.lambda$filter$0(Filters.java:83)
        at io.helidon.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:75)
        at io.helidon.webserver.http.Filters.filter(Filters.java:83)
        at io.helidon.webserver.http.HttpRoutingImpl.route(HttpRoutingImpl.java:73)
        at io.helidon.webserver.http1.Http1Connection.route(Http1Connection.java:357)
        at io.helidon.webserver.http1.Http1Connection.handle(Http1Connection.java:194)
        at io.helidon.webserver.ConnectionHandler.run(ConnectionHandler.java:165)
        at io.helidon.common.task.InterruptableTask.call(InterruptableTask.java:47)
        at io.helidon.webserver.ThreadPerTaskExecutor$ThreadBoundFuture.run(ThreadPerTaskExecutor.java:239)
        at java.base/java.lang.VirtualThread.run(VirtualThread.java:309)
MultiException stack 3 of 3
java.lang.IllegalStateException: Unable to perform operation: resolve on io.helidon.tests.integration.restclient.GreetResourceProxy
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:422)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:466)
        at org.glassfish.jersey.inject.hk2.RequestContext.findOrCreate(RequestContext.java:59)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2109)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:769)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:732)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:702)
        at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getInstance(AbstractHk2InjectionManager.java:160)
        at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getInstance(ImmediateHk2InjectionManager.java:30)
        at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:122)
        at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:260)
        at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:51)
        at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:86)
        at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
        at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
        at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:89)
        at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:69)
        at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:38)
        at org.glassfish.jersey.process.internal.Stages.process(Stages.java:173)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:266)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:266)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:253)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:696)
        at io.helidon.microprofile.server.JaxRsService.doHandle(JaxRsService.java:228)
        at io.helidon.microprofile.server.JaxRsService.lambda$handle$2(JaxRsService.java:185)
        at io.helidon.common.context.Contexts.runInContext(Contexts.java:117)
        at io.helidon.microprofile.server.JaxRsService.handle(JaxRsService.java:185)
        at io.helidon.webserver.http.HttpRoutingImpl$RoutingExecutor.doRoute(HttpRoutingImpl.java:165)
        at io.helidon.webserver.http.HttpRoutingImpl$RoutingExecutor.call(HttpRoutingImpl.java:124)
        at io.helidon.webserver.http.HttpRoutingImpl$RoutingExecutor.call(HttpRoutingImpl.java:102)
        at io.helidon.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:75)
        at io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:121)
        at io.helidon.webserver.observe.metrics.MetricsFeature.lambda$configureVendorMetrics$2(MetricsFeature.java:90)
        at io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:119)
        at io.helidon.common.context.Contexts.runInContext(Contexts.java:117)
        at io.helidon.webserver.context.ContextRoutingFeature.filter(ContextRoutingFeature.java:50)
        at io.helidon.webserver.http.Filters$FilterChainImpl.proceed(Filters.java:119)
        at io.helidon.webserver.http.Filters.executeFilters(Filters.java:87)
        at io.helidon.webserver.http.Filters.lambda$filter$0(Filters.java:83)
        at io.helidon.webserver.http.ErrorHandlers.runWithErrorHandling(ErrorHandlers.java:75)
        at io.helidon.webserver.http.Filters.filter(Filters.java:83)
        at io.helidon.webserver.http.HttpRoutingImpl.route(HttpRoutingImpl.java:73)
        at io.helidon.webserver.http1.Http1Connection.route(Http1Connection.java:357)
        at io.helidon.webserver.http1.Http1Connection.handle(Http1Connection.java:194)
        at io.helidon.webserver.ConnectionHandler.run(ConnectionHandler.java:165)
        at io.helidon.common.task.InterruptableTask.call(InterruptableTask.java:47)
        at io.helidon.webserver.ThreadPerTaskExecutor$ThreadBoundFuture.run(ThreadPerTaskExecutor.java:239)
        at java.base/java.lang.VirtualThread.run(VirtualThread.java:309)

@romain-grecourt romain-grecourt added bug Something isn't working MP rest-client 4.x Version 4.x labels Jun 14, 2024
@m0mus m0mus added the P2 label Jun 21, 2024
@m0mus m0mus added this to Backlog Aug 12, 2024
@m0mus m0mus moved this to In Progress in Backlog Aug 12, 2024
@Verdent Verdent linked a pull request Sep 26, 2024 that will close this issue
@Verdent Verdent moved this from In Progress to Sprint Scope in Backlog Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x bug Something isn't working MP P2 rest-client
Projects
Status: Sprint Scope
Development

Successfully merging a pull request may close this issue.

3 participants