OpenLiberty / open-liberty

Open Liberty is a highly composable, fast to start, dynamic application server runtime environment
https://openliberty.io
Eclipse Public License 2.0
1.15k stars 590 forks source link

remote API calls using RestClient #21547

Closed zahidr closed 1 year ago

zahidr commented 2 years ago

The steps followed download openliberty starter https://openliberty.io/start/ Coded three files below for registeresclient Interface restclientcontroller and datamodel. ran mvn liberty:dev command executed /api/tvseries on page http://localhost:9080/openapi/ui/ copied and pasted erroneous result with the three code files.

import com.demo.rest.model.TvSeries; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.QueryParam; import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

@RegisterRestClient(baseUri = "https://api.tvmaze.com/singlesearch/") public interface TvSeriesStub {

@Path("shows")
@GET
TvSeries get(@QueryParam("q") String title);

}


package com.demo.rest.controller;

import com.demo.rest.model.TvSeries; import com.demo.rest.stub.TvSeriesStub;

import jakarta.inject.Inject; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.eclipse.microprofile.rest.client.inject.RestClient;

import java.util.ArrayList; import java.util.List;

@Path("tvseries") public class TvSeriesController {

@Inject
@RestClient
private TvSeriesStub proxy;

private List<TvSeries> episodes = new ArrayList();

@GET
@Produces(MediaType.APPLICATION_JSON)
public Response get() {
    TvSeries girlEpisode = proxy.get("girls");
    episodes.add(girlEpisode);
    return Response.ok(episodes).build();
}

}


package com.demo.rest.model;

public class TvSeries { private Long id; private String name; private String language;

public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getLanguage() {
    return language;
}

public void setLanguage(String language) {
    this.language = language;
}

}

Error: Not Found

Response body <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

zahidr commented 2 years ago

console error I forgot to add

[INFO] [ERROR ] CWWKZ0004E: An exception occurred while starting the application app-name. The exception message was: com.ibm.ws.container.service.state.StateChangeException: org.jbo ss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type TvSeriesStub with qualifiers @RestClient [INFO] at injection point [BackedAnnotatedField] @Inject @RestClient private com.demo.rest.controller.TvSeriesController.proxy [INFO] at com.demo.rest.controller.TvSeriesController.proxy(TvSeriesController.java:0)

WhiteCat22 commented 2 years ago

Hi @zahidr, are you sending a request to a Websphere or Liberty server? the CONTEXT_ROOT_NOT_FOUND in the response body is suspicious to me. If the server is a Liberty server, can you upload the messages.log?

zahidr commented 2 years ago

product = Open Liberty 22.0.0.6 (wlp-1.0.65.cl220620220523-1607) wlp.install.dir = C:/micrprofile-projects/app-name/target/liberty/wlp/ java.home = c:\jdk-11 java.version = 11.0.13 java.runtime = OpenJDK Runtime Environment (11.0.13+8) os = Windows 10 (10.0; amd64) (en_GB) process = 2068@User-PC Classpath = C:\micrprofile-projects\app-name\target\liberty\wlp\bin\tools\ws-server.jar Java Library path = c:\jdk-11\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Python310\Scripts\;C:\Python310\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\ProgramData\chocolatey\bin;C:\nodejs\;C:\Users\User\AppData\Local\Microsoft\WindowsApps;c:\jdk-11\bin;C:\apache-maven-3.8.6\bin;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.3\bin;C:\Users\User\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\User\AppData\Local\atom\bin;C:\Users\User\AppData\Roaming\npm;C:\Users\User\AppData\Local\GitHubDesktop\bin;;.


[24/06/2022, 23:51:20:656 PKT] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager A CWWKE0001I: The server defaultServer has been launched. [24/06/2022, 23:51:22:531 PKT] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager I CWWKE0002I: The kernel started after 2.398 seconds [24/06/2022, 23:51:22:640 PKT] 00000025 com.ibm.ws.kernel.feature.internal.FeatureManager I CWWKF0007I: Feature update started. [24/06/2022, 23:51:23:672 PKT] 00000018 com.ibm.ws.security.registry.basic.internal.BasicRegistry W CWWKS3103W: There are no users defined for the BasicRegistry configuration of ID com.ibm.ws.security.registry.basic.config[basic]. [24/06/2022, 23:51:23:765 PKT] 00000018 com.ibm.ws.security.ready.internal.SecurityReadyServiceImpl I CWWKS0007I: The security service is starting... [24/06/2022, 23:51:24:187 PKT] 0000001c com.ibm.ws.app.manager.internal.monitor.DropinMonitor A CWWKZ0058I: Monitoring dropins for applications. [24/06/2022, 23:51:24:781 PKT] 00000019 com.ibm.ws.cache.ServerCache I DYNA1001I: WebSphere Dynamic Cache instance named baseCache initialized successfully. [24/06/2022, 23:51:24:812 PKT] 00000019 com.ibm.ws.cache.ServerCache I DYNA1071I: The cache provider default is being used. [24/06/2022, 23:51:24:828 PKT] 00000019 com.ibm.ws.cache.CacheServiceImpl I DYNA1056I: Dynamic Cache (object cache) initialized successfully. [24/06/2022, 23:51:25:718 PKT] 0000001b cxf.cxf.core.3.2.jakarta:1.0.65.cl220620220523-1607(id=279)] I Aries Blueprint packages not available. So namespaces will not be registered [24/06/2022, 23:51:26:062 PKT] 00000019 rty.security.mp.jwt.v12.config.impl.MpConfigProxyServiceImpl I CWWKS5780I: The MicroProfile JWT version 1.2 mpConfigProxy processed successfully. [24/06/2022, 23:51:26:062 PKT] 00000019 .ws.security.mp.jwt.v11.config.impl.MpConfigProxyServiceImpl I CWWKS5775I: The MicroProfile JWT version 1.1 mpConfigProxy processed successfully. [24/06/2022, 23:51:27:625 PKT] 0000001c com.ibm.ws.sib.utils.ras.SibMessage I CWSID0108I: JMS server has started.
[24/06/2022, 23:51:27:750 PKT] 00000021 com.ibm.ws.ssl.config.WSKeyStore A CWPKI0820A: The default keystore has been created using the 'keystore_password' environment variable. [24/06/2022, 23:51:27:843 PKT] 00000028 com.ibm.ws.security.ready.internal.SecurityReadyServiceImpl I CWWKS0008I: The security service is ready. [24/06/2022, 23:51:27:843 PKT] 00000028 com.ibm.ws.security.token.ltpa.internal.LTPAKeyCreateTask I CWWKS4105I: LTPA configuration is ready after 0.070 seconds. [24/06/2022, 23:51:27:859 PKT] 00000018 ibm.ws.security.authentication.internal.jaas.JAASServiceImpl I CWWKS1123I: The collective authentication plugin with class name NullCollectiveAuthenticationPlugin has been activated. [24/06/2022, 23:51:28:484 PKT] 00000021 com.ibm.ws.ssl.config.WSKeyStore I Successfully loaded default keystore: C:/micrprofile-projects/app-name/target/liberty/wlp/usr/servers/defaultServer/resources/security/key.p12 of type: PKCS12 [24/06/2022, 23:51:28:546 PKT] 00000021 com.ibm.ws.security.mp.jwt.impl.MicroProfileJwtServiceImpl I CWWKS5500I: The MicroProfile JWT configuration [MicroProfileJwtService] was successfully processed. [24/06/2022, 23:51:28:546 PKT] 00000021 com.ibm.ws.security.mp.jwt.impl.MicroProfileJwtConfigImpl I CWWKS5500I: The MicroProfile JWT configuration [defaultMpJwt] was successfully processed. [24/06/2022, 23:51:28:934 PKT] 00000018 com.ibm.ws.security.jaspi.AuthConfigFactoryWrapper I CWWKS1655I: The default Java Authentication SPI for Containers (JASPIC) AuthConfigFactory class com.ibm.ws.security.jaspi.ProviderRegistry is being used because the Java security property authconfigprovider.factory is not set. [24/06/2022, 23:51:28:996 PKT] 00000018 com.ibm.ws.security.jwt.internal.ConsumerImpl I CWWKS6012I: The JSON Web Token (JWT) consumer service is available. [24/06/2022, 23:51:29:043 PKT] 00000018 com.ibm.ws.security.jwt.web.JwtEndpointServices I CWWKS6002I: The JSON Web Token (JWT) endpoint service is available. [24/06/2022, 23:51:29:793 PKT] 00000018 com.ibm.ws.session.WASSessionCore I SESN8501I: The session manager did not find a persistent storage location; HttpSession objects will be stored in the local application server's memory. [24/06/2022, 23:51:29:981 PKT] 00000018 .microprofile.metrics.internal.monitor.MonitorMetricsHandler I CWPMI2003I: Monitoring metrics can be retrieved through mpMetrics. [24/06/2022, 23:51:30:293 PKT] 0000001b cxf.cxf.core.3.2.jakarta:1.0.65.cl220620220523-1607(id=279)] I Aries Blueprint packages not available. So namespaces will not be registered [24/06/2022, 23:51:30:309 PKT] 0000001b cxf.cxf.core.3.2.jakarta:1.0.65.cl220620220523-1607(id=279)] I Aries Blueprint packages not available. So namespaces will not be registered [24/06/2022, 23:51:30:309 PKT] 0000001b cxf.cxf.core.3.2.jakarta:1.0.65.cl220620220523-1607(id=279)] I Aries Blueprint packages not available. So namespaces will not be registered [24/06/2022, 23:51:30:324 PKT] 0000001b cxf.cxf.core.3.2.jakarta:1.0.65.cl220620220523-1607(id=279)] I Aries Blueprint packages not available. So namespaces will not be registered [24/06/2022, 23:51:30:371 PKT] 00000021 org.apache.cxf.ext.logging.osgi.Activator I CXF message logging feature disabled [24/06/2022, 23:51:30:559 PKT] 0000001b cxf.cxf.core.3.2.jakarta:1.0.65.cl220620220523-1607(id=279)] W Could not create a secure Stax XMLInputFactory. Found class com.sun.xml.internal.stream.XMLInputFactoryImpl. Suggest Woodstox 4.2.0 or newer. [24/06/2022, 23:51:31:090 PKT] 0000001a com.ibm.ws.transport.iiop.internal.ORBWrapperInternal A CWWKI0001I: The CORBA name server is now available at corbaloc:iiop:localhost:2809/NameService. [24/06/2022, 23:51:33:387 PKT] 00000028 com.ibm.ws.webcontainer.osgi.webapp.WebGroup I SRVE0169I: Loading Web Module: health. [24/06/2022, 23:51:33:387 PKT] 0000002b com.ibm.ws.webcontainer.osgi.webapp.WebGroup I SRVE0169I: Loading Web Module: io.openliberty.security.jwt.internal. [24/06/2022, 23:51:33:387 PKT] 00000028 com.ibm.ws.webcontainer I SRVE0250I: Web Module health has been bound to default_host. [24/06/2022, 23:51:33:387 PKT] 0000002a com.ibm.ws.webcontainer.osgi.webapp.WebGroup I SRVE0169I: Loading Web Module: OpenAPIUI. [24/06/2022, 23:51:33:402 PKT] 0000002a com.ibm.ws.webcontainer I SRVE0250I: Web Module OpenAPIUI has been bound to default_host. [24/06/2022, 23:51:33:387 PKT] 0000002b com.ibm.ws.webcontainer I SRVE0250I: Web Module io.openliberty.security.jwt.internal has been bound to default_host. [24/06/2022, 23:51:33:387 PKT] 00000027 com.ibm.ws.webcontainer.osgi.webapp.WebGroup I SRVE0169I: Loading Web Module: IBMJMXConnectorREST. [24/06/2022, 23:51:33:402 PKT] 00000027 com.ibm.ws.webcontainer I SRVE0250I: Web Module IBMJMXConnectorREST has been bound to default_host. [24/06/2022, 23:51:33:387 PKT] 0000002d com.ibm.ws.webcontainer.osgi.webapp.WebGroup I SRVE0169I: Loading Web Module: MicroProfileOpenAPI. [24/06/2022, 23:51:33:402 PKT] 0000002d com.ibm.ws.webcontainer I SRVE0250I: Web Module MicroProfileOpenAPI has been bound to default_host. [24/06/2022, 23:51:33:387 PKT] 00000026 com.ibm.ws.webcontainer.osgi.webapp.WebGroup I SRVE0169I: Loading Web Module: ibm/api. [24/06/2022, 23:51:33:402 PKT] 00000026 com.ibm.ws.webcontainer I SRVE0250I: Web Module ibm/api has been bound to default_host. [24/06/2022, 23:51:33:402 PKT] 00000028 com.ibm.ws.http.internal.VirtualHostImpl A CWWKT0016I: Web application available (default_host): http://localhost:9080/health/ [24/06/2022, 23:51:33:402 PKT] 00000026 com.ibm.ws.http.internal.VirtualHostImpl A CWWKT0016I: Web application available (default_host): http://localhost:9080/ibm/api/ [24/06/2022, 23:51:33:402 PKT] 0000002d com.ibm.ws.http.internal.VirtualHostImpl A CWWKT0016I: Web application available (default_host): http://localhost:9080/openapi/ [24/06/2022, 23:51:33:402 PKT] 00000027 com.ibm.ws.http.internal.VirtualHostImpl A CWWKT0016I: Web application available (default_host): http://localhost:9080/IBMJMXConnectorREST/ [24/06/2022, 23:51:33:434 PKT] 00000027 com.ibm.ws.jmx.connector.server.rest.RESTAppListener I CWWKX0103I: The JMX REST connector is running and is available at the following service URL: service:jmx:rest://localhost:9443/IBMJMXConnectorREST [24/06/2022, 23:51:33:480 PKT] 00000027 com.ibm.ws.jmx.connector.server.rest.RESTAppListener I CWWKX0103I: The JMX REST connector is running and is available at the following service URL: service:jmx:rest://localhost:9443/IBMJMXConnectorREST [24/06/2022, 23:51:33:480 PKT] 0000002b com.ibm.ws.http.internal.VirtualHostImpl A CWWKT0016I: Web application available (default_host): http://localhost:9080/jwt/ [24/06/2022, 23:51:33:496 PKT] 0000002a com.ibm.ws.http.internal.VirtualHostImpl A CWWKT0016I: Web application available (default_host): http://localhost:9080/openapi/ui/ [24/06/2022, 23:51:33:496 PKT] 00000028 com.ibm.ws.webcontainer.osgi.webapp.WebGroup I SRVE0169I: Loading Web Module: PrivateMicroProfileMetrics. [24/06/2022, 23:51:33:496 PKT] 00000028 com.ibm.ws.webcontainer I SRVE0250I: Web Module PrivateMicroProfileMetrics has been bound to default_host. [24/06/2022, 23:51:33:496 PKT] 00000028 com.ibm.ws.http.internal.VirtualHostImpl A CWWKT0016I: Web application available (default_host): http://localhost:9080/metrics/ [24/06/2022, 23:51:33:590 PKT] 00000026 com.ibm.ws.webcontainer.osgi.webapp.WebGroup I SRVE0169I: Loading Web Module: /openapi/platform. [24/06/2022, 23:51:33:590 PKT] 00000026 com.ibm.ws.webcontainer I SRVE0250I: Web Module /openapi/platform has been bound to default_host. [24/06/2022, 23:51:33:590 PKT] 00000026 com.ibm.ws.http.internal.VirtualHostImpl A CWWKT0016I: Web application available (default_host): http://localhost:9080/openapi/platform/ [24/06/2022, 23:51:33:637 PKT] 0000002d com.ibm.ws.app.manager.AppMessageHelper I CWWKZ0018I: Starting application app-name. [24/06/2022, 23:51:33:637 PKT] 0000002d bm.ws.app.manager.war.internal.WARDeployedAppInfoFactoryImpl I CWWKZ0134I: The app-name application is using the loose application definition at the C:\micrprofile-projects\app-name\target\liberty\wlp\usr\servers\defaultServer\apps\app-name.war.xml location. [24/06/2022, 23:51:33:730 PKT] 00000050 com.ibm.ws.webcontainer.osgi.mbeans.PluginGenerator I SRVE9103I: A configuration file for a web server plugin was automatically generated for this server at C:\micrprofile-projects\app-name\target\liberty\wlp\usr\servers\defaultServer\logs\state\plugin-cfg.xml. [24/06/2022, 23:51:33:855 PKT] 0000004f com.ibm.ws.session.WASSessionCore I SESN0176I: A new session context will be created for application key default_host/metrics [24/06/2022, 23:51:33:855 PKT] 00000028 com.ibm.ws.session.WASSessionCore I SESN0176I: A new session context will be created for application key default_host/IBMJMXConnectorREST [24/06/2022, 23:51:33:855 PKT] 0000002b com.ibm.ws.session.WASSessionCore I SESN0176I: A new session context will be created for application key default_host/health [24/06/2022, 23:51:33:855 PKT] 00000052 com.ibm.ws.session.WASSessionCore I SESN0176I: A new session context will be created for application key default_host/jwt [24/06/2022, 23:51:33:855 PKT] 00000051 com.ibm.ws.session.WASSessionCore I SESN0176I: A new session context will be created for application key default_host/openapi/ui [24/06/2022, 23:51:33:855 PKT] 00000050 com.ibm.ws.session.WASSessionCore I SESN0176I: A new session context will be created for application key default_host/openapi/platform [24/06/2022, 23:51:33:855 PKT] 0000002a com.ibm.ws.session.WASSessionCore I SESN0176I: A new session context will be created for application key default_host/ibm/api [24/06/2022, 23:51:33:855 PKT] 00000027 com.ibm.ws.session.WASSessionCore I SESN0176I: A new session context will be created for application key default_host/openapi [24/06/2022, 23:51:34:012 PKT] 0000004f com.ibm.ws.util I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation. [24/06/2022, 23:51:34:043 PKT] 00000027 com.ibm.ws.util I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation. [24/06/2022, 23:51:34:043 PKT] 0000002a com.ibm.ws.util I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation. [24/06/2022, 23:51:34:043 PKT] 00000050 com.ibm.ws.util I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation. [24/06/2022, 23:51:34:059 PKT] 00000051 com.ibm.ws.util I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation. [24/06/2022, 23:51:34:059 PKT] 00000052 com.ibm.ws.util I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation. [24/06/2022, 23:51:34:059 PKT] 0000002b com.ibm.ws.util I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation. [24/06/2022, 23:51:34:074 PKT] 00000028 com.ibm.ws.util I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation. [24/06/2022, 23:51:34:184 PKT] 0000004f org.hibernate.validator.internal.util.Version I HV000001: Hibernate Validator 7.0.4.Final [24/06/2022, 23:51:35:090 PKT] 0000002a com.ibm.ws.cache.CacheServiceImpl I DYNA1056I: Dynamic Cache (object cache) initialized successfully. [24/06/2022, 23:51:35:137 PKT] 0000002a org.apache.myfaces.ee.MyFacesContainerInitializer I Using org.apache.myfaces.ee.MyFacesContainerInitializer [24/06/2022, 23:51:35:137 PKT] 00000027 org.apache.myfaces.ee.MyFacesContainerInitializer I Using org.apache.myfaces.ee.MyFacesContainerInitializer [24/06/2022, 23:51:35:137 PKT] 00000028 org.apache.myfaces.ee.MyFacesContainerInitializer I Using org.apache.myfaces.ee.MyFacesContainerInitializer [24/06/2022, 23:51:35:137 PKT] 0000004f org.apache.myfaces.ee.MyFacesContainerInitializer I Using org.apache.myfaces.ee.MyFacesContainerInitializer [24/06/2022, 23:51:35:137 PKT] 0000002b org.apache.myfaces.ee.MyFacesContainerInitializer I Using org.apache.myfaces.ee.MyFacesContainerInitializer [24/06/2022, 23:51:35:137 PKT] 00000052 org.apache.myfaces.ee.MyFacesContainerInitializer I Using org.apache.myfaces.ee.MyFacesContainerInitializer [24/06/2022, 23:51:35:137 PKT] 00000050 org.apache.myfaces.ee.MyFacesContainerInitializer I Using org.apache.myfaces.ee.MyFacesContainerInitializer [24/06/2022, 23:51:35:137 PKT] 00000051 org.apache.myfaces.ee.MyFacesContainerInitializer I Using org.apache.myfaces.ee.MyFacesContainerInitializer [24/06/2022, 23:51:35:512 PKT] 0000002d liberty.microprofile.openapi20.internal.ApplicationProcessor I CWWKO1660I: The application app-name was processed and an OpenAPI document was produced. [24/06/2022, 23:51:35:574 PKT] 0000004f com.ibm.ws.webcontainer.servlet I SRVE0242I: [io.openliberty.microprofile.metrics.internal.private] [/metrics] [PrivateMetricsRESTProxyServlet]: Initialization successful. [24/06/2022, 23:51:35:590 PKT] 00000027 com.ibm.ws.webcontainer.servlet I SRVE0242I: [io.openliberty.microprofile.openapi.2.0.internal.jakarta] [/openapi] [ApplicationServlet]: Initialization successful. [24/06/2022, 23:51:35:605 PKT] 00000028 com.ibm.ws.webcontainer.servlet I SRVE0242I: [com.ibm.ws.jmx.connector.server.rest.jakarta] [/IBMJMXConnectorREST] [JMXRESTProxyServlet]: Initialization successful. [24/06/2022, 23:51:35:621 PKT] 0000002d org.jboss.weld.Version I WELD-000900: 4.0.3 (Final) [24/06/2022, 23:51:35:621 PKT] 0000002b com.ibm.ws.webcontainer.servlet I SRVE0242I: [io.openliberty.microprofile.health.3.1.internal.jakarta] [/health] [HealthCheckReadinessServlet]: Initialization successful. [24/06/2022, 23:51:35:621 PKT] 0000002b com.ibm.ws.webcontainer.servlet I SRVE0242I: [io.openliberty.microprofile.health.3.1.internal.jakarta] [/health] [HealthCheckServlet]: Initialization successful. [24/06/2022, 23:51:35:637 PKT] 0000002b com.ibm.ws.webcontainer.servlet I SRVE0242I: [io.openliberty.microprofile.health.3.1.internal.jakarta] [/health] [HealthCheckStartupServlet]: Initialization successful. [24/06/2022, 23:51:35:637 PKT] 0000002b com.ibm.ws.webcontainer.servlet I SRVE0242I: [io.openliberty.microprofile.health.3.1.internal.jakarta] [/health] [HealthCheckLivenessServlet]: Initialization successful. [24/06/2022, 23:51:37:183 PKT] 0000002d org.jboss.weld.Event I WELD-000411: Observer method [BackedAnnotatedMethod] org.apache.myfaces.cdi.JsfArtifactProducerExtension.processAnnotatedType(@Observes ProcessAnnotatedType, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. [24/06/2022, 23:51:37:183 PKT] 0000002d org.jboss.weld.Event I WELD-000411: Observer method [BackedAnnotatedMethod] org.apache.myfaces.config.annotation.CdiAnnotationProviderExtension.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. [24/06/2022, 23:51:39:089 PKT] 0000002d com.ibm.ws.logging.internal.impl.IncidentImpl I FFDC1015I: An FFDC Incident has been created: "org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type TvSeriesStub with qualifiers @RestClient at injection point [BackedAnnotatedField] @Inject @RestClient private com.demo.rest.controller.TvSeriesController.proxy at com.demo.rest.controller.TvSeriesController.proxy(TvSeriesController.java:0) com.ibm.ws.container.service.state.internal.ApplicationStateManager 54" at ffdc_22.06.24_23.51.38.0.log [24/06/2022, 23:51:39:449 PKT] 0000002d com.ibm.ws.logging.internal.impl.IncidentImpl I FFDC1015I: An FFDC Incident has been created: "com.ibm.ws.container.service.state.StateChangeException: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type TvSeriesStub with qualifiers @RestClient at injection point [BackedAnnotatedField] @Inject @RestClient private com.demo.rest.controller.TvSeriesController.proxy at com.demo.rest.controller.TvSeriesController.proxy(TvSeriesController.java:0) com.ibm.ws.app.manager.module.internal.SimpleDeployedAppInfoBase 548" at ffdc_22.06.24_23.51.39.0.log [24/06/2022, 23:51:39:511 PKT] 0000002d com.ibm.ws.app.manager.AppMessageHelper E CWWKZ0002E: An exception occurred while starting the application app-name. The exception message was: com.ibm.ws.container.service.state.StateChangeException: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type TvSeriesStub with qualifiers @RestClient at injection point [BackedAnnotatedField] @Inject @RestClient private com.demo.rest.controller.TvSeriesController.proxy at com.demo.rest.controller.TvSeriesController.proxy(TvSeriesController.java:0)

[24/06/2022, 23:51:39:581 PKT] 00000025 com.ibm.ws.tcpchannel.internal.TCPPort I CWWKO0219I: TCP Channel defaultHttpEndpoint has been started and is now listening for requests on host 127.0.0.1 (IPv4: 127.0.0.1) port 9080. [24/06/2022, 23:51:39:581 PKT] 00000025 com.ibm.ws.tcpchannel.internal.TCPPort I CWWKO0219I: TCP Channel wasJmsEndpoint464 has been started and is now listening for requests on host 127.0.0.1 (IPv4: 127.0.0.1) port 7276. [24/06/2022, 23:51:39:581 PKT] 00000025 com.ibm.ws.tcpchannel.internal.TCPPort I CWWKO0219I: TCP Channel defaultHttpEndpoint-ssl has been started and is now listening for requests on host 127.0.0.1 (IPv4: 127.0.0.1) port 9443. [24/06/2022, 23:51:39:581 PKT] 00000025 com.ibm.ws.tcpchannel.internal.TCPPort I CWWKO0219I: TCP Channel wasJmsEndpoint464-ssl has been started and is now listening for requests on host 127.0.0.1 (IPv4: 127.0.0.1) port 7286. [24/06/2022, 23:51:39:628 PKT] 00000025 com.ibm.ws.kernel.feature.internal.FeatureManager A CWWKF0012I: The server installed the following features: [appAuthentication-2.0, appAuthorization-2.0, appClientSupport-2.0, appSecurity-4.0, batch-2.0, beanValidation-3.0, cdi-3.0, concurrent-2.0, connectors-2.0, connectorsInboundSecurity-2.0, distributedMap-1.0, enterpriseBeans-4.0, enterpriseBeansHome-4.0, enterpriseBeansLite-4.0, enterpriseBeansPersistentTimer-4.0, enterpriseBeansRemote-4.0, expressionLanguage-4.0, faces-3.0, jakartaee-9.1, jdbc-4.2, jndi-1.0, json-1.0, jsonb-2.0, jsonp-2.0, jwt-1.0, mail-2.0, managedBeans-2.0, mdb-4.0, messaging-3.0, messagingClient-3.0, messagingSecurity-3.0, messagingServer-3.0, microProfile-5.0, monitor-1.0, mpConfig-3.0, mpFaultTolerance-4.0, mpHealth-4.0, mpJwt-2.0, mpMetrics-4.0, mpOpenAPI-3.0, mpOpenTracing-3.0, mpRestClient-3.0, pages-3.0, persistence-3.0, persistenceContainer-3.0, restConnector-2.0, restfulWS-3.0, restfulWSClient-3.0, servlet-5.0, ssl-1.0, transportSecurity-1.0, webProfile-9.1, websocket-2.0, xmlBinding-3.0, xmlWS-3.0]. [24/06/2022, 23:51:39:628 PKT] 00000025 com.ibm.ws.kernel.feature.internal.FeatureManager I CWWKF0008I: Feature update completed in 17.112 seconds. [24/06/2022, 23:51:39:628 PKT] 00000025 com.ibm.ws.kernel.feature.internal.FeatureManager A CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 19.512 seconds. [24/06/2022, 23:51:43:428 PKT] 0000002d com.ibm.ws.app.manager.AppMessageHelper I CWWKZ0018I: Starting application app-name. [24/06/2022, 23:51:43:428 PKT] 0000002d bm.ws.app.manager.war.internal.WARDeployedAppInfoFactoryImpl I CWWKZ0134I: The app-name application is using the loose application definition at the C:\micrprofile-projects\app-name\target\liberty\wlp\usr\servers\defaultServer\apps\app-name.war.xml location. [24/06/2022, 23:51:43:616 PKT] 0000002d liberty.microprofile.openapi20.internal.ApplicationProcessor I CWWKO1660I: The application app-name was processed and an OpenAPI document was produced. [24/06/2022, 23:51:43:897 PKT] 0000002d org.jboss.weld.Event I WELD-000411: Observer method [BackedAnnotatedMethod] org.apache.myfaces.cdi.JsfArtifactProducerExtension.processAnnotatedType(@Observes ProcessAnnotatedType, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. [24/06/2022, 23:51:43:897 PKT] 0000002d org.jboss.weld.Event I WELD-000411: Observer method [BackedAnnotatedMethod] org.apache.myfaces.config.annotation.CdiAnnotationProviderExtension.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. [24/06/2022, 23:51:44:741 PKT] 0000002d com.ibm.ws.app.manager.AppMessageHelper E CWWKZ0004E: An exception occurred while starting the application app-name. The exception message was: com.ibm.ws.container.service.state.StateChangeException: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type TvSeriesStub with qualifiers @RestClient at injection point [BackedAnnotatedField] @Inject @RestClient private com.demo.rest.controller.TvSeriesController.proxy at com.demo.rest.controller.TvSeriesController.proxy(TvSeriesController.java:0)

[24/06/2022, 23:52:08:735 PKT] 0000005b com.ibm.ws.app.manager.AppMessageHelper I CWWKZ0018I: Starting application app-name. [24/06/2022, 23:52:08:735 PKT] 0000005b bm.ws.app.manager.war.internal.WARDeployedAppInfoFactoryImpl I CWWKZ0134I: The app-name application is using the loose application definition at the C:\micrprofile-projects\app-name\target\liberty\wlp\usr\servers\defaultServer\apps\app-name.war.xml location. [24/06/2022, 23:52:09:097 PKT] 0000005b liberty.microprofile.openapi20.internal.ApplicationProcessor I CWWKO1660I: The application app-name was processed and an OpenAPI document was produced. [24/06/2022, 23:52:09:335 PKT] 0000005b org.jboss.weld.Event I WELD-000411: Observer method [BackedAnnotatedMethod] org.apache.myfaces.config.annotation.CdiAnnotationProviderExtension.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. [24/06/2022, 23:52:09:335 PKT] 0000005b org.jboss.weld.Event I WELD-000411: Observer method [BackedAnnotatedMethod] org.apache.myfaces.cdi.JsfArtifactProducerExtension.processAnnotatedType(@Observes ProcessAnnotatedType, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. [24/06/2022, 23:52:10:210 PKT] 0000005b com.ibm.ws.app.manager.AppMessageHelper E CWWKZ0004E: An exception occurred while starting the application app-name. The exception message was: com.ibm.ws.container.service.state.StateChangeException: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type TvSeriesStub with qualifiers @RestClient at injection point [BackedAnnotatedField] @Inject @RestClient private com.demo.rest.controller.TvSeriesController.proxy at com.demo.rest.controller.TvSeriesController.proxy(TvSeriesController.java:0)

[24/06/2022, 23:56:45:973 PKT] 0000002d com.ibm.ws.app.manager.AppMessageHelper I CWWKZ0018I: Starting application app-name. [24/06/2022, 23:56:45:973 PKT] 0000002d bm.ws.app.manager.war.internal.WARDeployedAppInfoFactoryImpl I CWWKZ0134I: The app-name application is using the loose application definition at the C:\micrprofile-projects\app-name\target\liberty\wlp\usr\servers\defaultServer\apps\app-name.war.xml location. [24/06/2022, 23:56:46:176 PKT] 0000002d liberty.microprofile.openapi20.internal.ApplicationProcessor I CWWKO1660I: The application app-name was processed and an OpenAPI document was produced. [24/06/2022, 23:56:46:426 PKT] 0000002d org.jboss.weld.Event I WELD-000411: Observer method [BackedAnnotatedMethod] org.apache.myfaces.config.annotation.CdiAnnotationProviderExtension.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. [24/06/2022, 23:56:46:426 PKT] 0000002d org.jboss.weld.Event I WELD-000411: Observer method [BackedAnnotatedMethod] org.apache.myfaces.cdi.JsfArtifactProducerExtension.processAnnotatedType(@Observes ProcessAnnotatedType, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. [24/06/2022, 23:56:47:051 PKT] 0000002d com.ibm.ws.app.manager.AppMessageHelper E CWWKZ0004E: An exception occurred while starting the application app-name. The exception message was: com.ibm.ws.container.service.state.StateChangeException: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type TvSeriesStub with qualifiers @RestClient at injection point [BackedAnnotatedField] @Inject @RestClient private com.demo.rest.controller.TvSeriesController.proxy at com.demo.rest.controller.TvSeriesController.proxy(TvSeriesController.java:0)

[24/06/2022, 23:57:22:801 PKT] 00000069 com.ibm.ws.app.manager.AppMessageHelper I CWWKZ0018I: Starting application app-name. [24/06/2022, 23:57:22:801 PKT] 00000069 bm.ws.app.manager.war.internal.WARDeployedAppInfoFactoryImpl I CWWKZ0134I: The app-name application is using the loose application definition at the C:\micrprofile-projects\app-name\target\liberty\wlp\usr\servers\defaultServer\apps\app-name.war.xml location. [24/06/2022, 23:57:22:953 PKT] 00000069 liberty.microprofile.openapi20.internal.ApplicationProcessor I CWWKO1660I: The application app-name was processed and an OpenAPI document was produced. [24/06/2022, 23:57:23:248 PKT] 00000069 org.jboss.weld.Event I WELD-000411: Observer method [BackedAnnotatedMethod] org.apache.myfaces.cdi.JsfArtifactProducerExtension.processAnnotatedType(@Observes ProcessAnnotatedType, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. [24/06/2022, 23:57:23:248 PKT] 00000069 org.jboss.weld.Event I WELD-000411: Observer method [BackedAnnotatedMethod] org.apache.myfaces.config.annotation.CdiAnnotationProviderExtension.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. [24/06/2022, 23:57:24:539 PKT] 00000069 com.ibm.ws.app.manager.AppMessageHelper E CWWKZ0004E: An exception occurred while starting the application app-name. The exception message was: com.ibm.ws.container.service.state.StateChangeException: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type TvSeriesStub with qualifiers @RestClient at injection point [BackedAnnotatedField] @Inject @RestClient private com.demo.rest.controller.TvSeriesController.proxy at com.demo.rest.controller.TvSeriesController.proxy(TvSeriesController.java:0)

zahidr commented 2 years ago

adding a scoped annotation has removed the error and it now works.

@ApplicationScoped @RegisterRestClient(baseUri = "https://api.tvmaze.com/singlesearch/") public interface TvSeriesStub {

@Path("shows")
@GET
TvSeries get(@QueryParam("q") String title);

}

zahidr commented 2 years ago

you may wish to have a look at these warning messages

[INFO] [WARNING ] RESTEASY004687: Closing a class org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient43Engine instance for you. Please close clients yourself. [INFO] [WARNING ] RESTEASY004687: Closing a class org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient43Engine instance for you. Please close clients yourself. [INFO] [WARNING ] RESTEASY004687: Closing a class org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient43Engine instance for you. Please close clients yourself.

Emily-Jiang commented 2 years ago

@WhiteCat22 You can replicate the issue using this github repo shared by @zahidr (Thanks Zahid!) The extra annotation @Dependent should not be necessary on the interface as the Sterotype annotation RegisterRestClient has Dependent included already. @WhiteCat22 I am wondering whether the steoretype was ignored when adding the beans. Please take a look on the CDI extension code from MicroProfile Rest Client.

benjamin-confino commented 2 years ago

I downloaded and ran the github provided, and it seems to work. If I visit http://localhost:9080/movie-maze-api/api/tvseries I get the following:

id 82
language "English"
name "Game of Thrones"
officialSite "http://www.hbo.com/game-of-thrones"
url "https://www.tvmaze.com/shows/82/game-of-thrones"

There is no CWWKZ0004E error in the logs. Is there a different URL or additional step I need to do to recreate the issue?

Emily-Jiang commented 2 years ago

@benjamin-confino What you need to do is to remove @ApplicationScoped from the following interface to recreate the problem.

@ApplicationScoped
@RegisterRestClient(baseUri = "https://api.tvmaze.com/singlesearch/")
public interface TvSeriesStub {
benjamin-confino commented 2 years ago

The solution turned out to be simple. @RegisterRestClient was not being registered as a BDA.

Emily-Jiang commented 2 years ago

The solution turned out to be simple. @RegisterRestClient was not being registered as a BDA.

Thank you @benjamin-confino for figuring it out!

zahidr commented 2 years ago

what does it mean that @RegisterRestClient was not being registered as a BDA ? what is the code/config fix ?

https://www https://Backbutton.org.backbutton.org ¯_(ツ)_/¯ ♡۶♡ ۶♡۶

http://www.backbutton.co.uk

On Thu, 7 Jul 2022 at 17:20, Benjamin Confino @.***> wrote:

The solution turned out to be simple. @RegisterRestClient was not being registered as a BDA.

— Reply to this email directly, view it on GitHub https://github.com/OpenLiberty/open-liberty/issues/21547#issuecomment-1177521963, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEASC3RYLC5TE4LZJM6AN63VS3DRPANCNFSM5ZYRCWGQ . You are receiving this because you were mentioned.Message ID: @.***>

Emily-Jiang commented 2 years ago

what does it mean that @RegisterRestClient was not being registered as a BDA ? what is the code/config fix ? https://www https://Backbutton.org.backbutton.org ¯_(ツ)_/¯ ♡۶♡ ۶♡۶ http://www.backbutton.co.uk On Thu, 7 Jul 2022 at 17:20, Benjamin Confino @.> wrote: The solution turned out to be simple. @RegisterRestClient was not being registered as a BDA. — Reply to this email directly, view it on GitHub <#21547 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEASC3RYLC5TE4LZJM6AN63VS3DRPANCNFSM5ZYRCWGQ . You are receiving this because you were mentioned.Message ID: @.>

BDA means Bean Defining Annotation. @RegisterRestClient is a sterotype and it should be registered as a bean. It is a product bug. A PR will be associated with this issue in due course.

zahidr commented 2 years ago

I wasn't sure what BDA meant so I created a beans.xml, removed the @Dependent annotation from the Interface and that works.

<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" bean-discovery-mode="all" version="2.0">

@RegisterRestClient(baseUri = "https://api.tvmaze.com/singlesearch/") public interface TvSeriesStub extends AutoCloseable{

@Path("shows")
@GET
TvSeries ***@***.***("q") String title);

}

https://www https://Backbutton.org.backbutton.org ¯_(ツ)_/¯ ♡۶♡ ۶♡۶

http://www.backbutton.co.uk

On Thu, 7 Jul 2022 at 21:21, Emily Jiang @.***> wrote:

what does it mean that @RegisterRestClient was not being registered as a BDA ? what is the code/config fix ? https://www https://Backbutton.org. backbutton.org ¯(ツ)/¯ ♡۶♡ ۶♡۶ http://www.backbutton.co.uk … <#m-7682460818893856938> On Thu, 7 Jul 2022 at 17:20, Benjamin Confino @.> wrote: The solution turned out to be simple. @RegisterRestClient was not being registered as a BDA. — Reply to this email directly, view it on GitHub <#21547 (comment) https://github.com/OpenLiberty/open-liberty/issues/21547#issuecomment-1177521963>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEASC3RYLC5TE4LZJM6AN63VS3DRPANCNFSM5ZYRCWGQ https://github.com/notifications/unsubscribe-auth/AEASC3RYLC5TE4LZJM6AN63VS3DRPANCNFSM5ZYRCWGQ . You are receiving this because you were mentioned.Message ID: @.>

BDA means Bean Defining Annotation. @RegisterRestClient is a sterotype and it should be registered as a bean. It is a product bug. A PR will be associated with this issue in due course.

— Reply to this email directly, view it on GitHub https://github.com/OpenLiberty/open-liberty/issues/21547#issuecomment-1177884180, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEASC3UPXJZ44QMKKFVTFOLVS37YZANCNFSM5ZYRCWGQ . You are receiving this because you were mentioned.Message ID: @.***>

Emily-Jiang commented 2 years ago

I wasn't sure what BDA meant so I created a beans.xml, removed the @dependent annotation from the Interface and that works. @RegisterRestClient(baseUri = "https://api.tvmaze.com/singlesearch/") public interface TvSeriesStub extends AutoCloseable{ @path("shows") @get TvSeries @.("q") String title); } https://www https://Backbutton.org.backbutton.org ¯_(ツ)_/¯ ♡۶♡ ۶♡۶ http://www.backbutton.co.uk On Thu, 7 Jul 2022 at 21:21, Emily Jiang @.> wrote: what does it mean that @RegisterRestClient was not being registered as a BDA ? what is the code/config fix ? https://www https://Backbutton.org. backbutton.org ¯(ツ)/¯ ♡۶♡ ۶♡۶ http://www.backbutton.co.uk … <#m-7682460818893856938> On Thu, 7 Jul 2022 at 17:20, Benjamin Confino @.> wrote: The solution turned out to be simple. @RegisterRestClient was not being registered as a BDA. — Reply to this email directly, view it on GitHub <#21547 (comment) <#21547 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEASC3RYLC5TE4LZJM6AN63VS3DRPANCNFSM5ZYRCWGQ https://github.com/notifications/unsubscribe-auth/AEASC3RYLC5TE4LZJM6AN63VS3DRPANCNFSM5ZYRCWGQ . You are receiving this because you were mentioned.Message ID: @.> BDA means Bean Defining Annotation. @RegisterRestClient is a sterotype and it should be registered as a bean. It is a product bug. A PR will be associated with this issue in due course. — Reply to this email directly, view it on GitHub <#21547 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEASC3UPXJZ44QMKKFVTFOLVS37YZANCNFSM5ZYRCWGQ . You are receiving this because you were mentioned.Message ID: @.***>

What you have done above is still a workaround. What I meant is that Open Liberty will provide a fix so that you don't have to either adding a beans.xml or adding @ApplicationScoped or other bean defining annotations on the interface. Hope this explains!

jim-krueger commented 2 years ago

The automated tooling will eventually add a notification, but in the mean-time this is the pull request that fixes this issue: https://github.com/OpenLiberty/open-liberty/pull/21678

zahidr commented 2 years ago

beans.xml is still a workaround. OK. Thanks.

https://www https://Backbutton.org.backbutton.org ¯_(ツ)_/¯ ♡۶♡ ۶♡۶

http://www.backbutton.co.uk

On Thu, 7 Jul 2022 at 22:50, Emily Jiang @.***> wrote:

I wasn't sure what BDA meant so I created a beans.xml, removed the @dependent https://github.com/dependent annotation from the Interface and that works. @RegisterRestClient(baseUri = " https://api.tvmaze.com/singlesearch/") public interface TvSeriesStub extends AutoCloseable{ @path https://github.com/path("shows") @get https://github.com/get TvSeries @.

("q") String title); } https://www https://www https://Backbutton.org https://Backbutton.org.backbutton.org http://backbutton.org ¯(ツ)/¯ ♡۶♡ ۶♡۶ http://www.backbutton.co.uk http://www.backbutton.co.uk … <#m-3572286840644662612> On Thu, 7 Jul 2022 at 21:21, Emily Jiang @.> wrote: what does it mean that @RegisterRestClient was not being registered as a BDA ? what is the code/config fix ? https://www https://Backbutton.org. backbutton.org ¯(ツ)/¯ ♡۶♡ ۶♡۶ http://www.backbutton.co.uk http://www.backbutton.co.uk … <#m-7682460818893856938> On Thu, 7 Jul 2022 at 17:20, Benjamin Confino @.> wrote: The solution turned out to be simple. @RegisterRestClient was not being registered as a BDA. — Reply to this email directly, view it on GitHub <#21547 https://github.com/OpenLiberty/open-liberty/issues/21547 (comment) <#21547 (comment) https://github.com/OpenLiberty/open-liberty/issues/21547#issuecomment-1177521963>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEASC3RYLC5TE4LZJM6AN63VS3DRPANCNFSM5ZYRCWGQ https://github.com/notifications/unsubscribe-auth/AEASC3RYLC5TE4LZJM6AN63VS3DRPANCNFSM5ZYRCWGQ https://github.com/notifications/unsubscribe-auth/AEASC3RYLC5TE4LZJM6AN63VS3DRPANCNFSM5ZYRCWGQ https://github.com/notifications/unsubscribe-auth/AEASC3RYLC5TE4LZJM6AN63VS3DRPANCNFSM5ZYRCWGQ . You are receiving this because you were mentioned.Message ID: @.> BDA means Bean Defining Annotation. @RegisterRestClient is a sterotype and it should be registered as a bean. It is a product bug. A PR will be associated with this issue in due course. — Reply to this email directly, view it on GitHub <#21547 (comment) https://github.com/OpenLiberty/open-liberty/issues/21547#issuecomment-1177884180>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEASC3UPXJZ44QMKKFVTFOLVS37YZANCNFSM5ZYRCWGQ . You are receiving this because you were mentioned.Message ID: @.***>

What you have done above is still a workaround. What I meant is that Open Liberty will provide a fix so that you don't have to either adding a beans.xml or adding @ApplicationScoped or other bean defining annotations on the interface. Hope this explains!

— Reply to this email directly, view it on GitHub https://github.com/OpenLiberty/open-liberty/issues/21547#issuecomment-1177996006, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEASC3U4447GQKAMDTDIPJDVS4KEVANCNFSM5ZYRCWGQ . You are receiving this because you were mentioned.Message ID: @.***>

WhiteCat22 commented 2 years ago

https://github.com/OpenLiberty/open-liberty/pull/21678 has been merged and should be in 22.0.0.8.

youssefgh commented 1 year ago

@WhiteCat22 the issue still persist in 22.0.0.12 Using the provided repo, after calling about 10 times the rest endpoint, the multiple messages appear again :

[WARNING ] RESTEASY004687: Closing a class org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient43Engine instance for you. Please close clients yourself

After adding @RequestScoped and a @PreDestroy with

((AutoCloseable)proxy).close();

The client is manually closed and the message goes away...

jim-krueger commented 1 year ago

@youssefgh Are you seeing this issue running the same (or similar) example to what was posted by @Emily-Jiang and @zahidr above? If not, how is what you are doing different?
I assume when you said, "using the provided repo" that is what you meant, but I'd like to confirm this.
Thanks

youssefgh commented 1 year ago

yes @jim-krueger using the same example

jim-krueger commented 1 year ago

Received the following email from @youssefgh and will close this issue.

_Issue no longer happening with latest version (23.0.0.3) I think i think this issue can be closed_

yooman00 commented 7 months ago

@WhiteCat22 Calling the RestClient in a CDI @RequestScoped require to explicit close the client. Otherwise this warning appears. Running in 23.0.0.10. [WARNING ] RESTEASY004687: Closing a class org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient43Engine instance for you. Please close clients yourself

Is this an expected behavior? Shouldn't the rest client be automatically closed, when the CDI bean get destroyed?

Manually closing makes the message go away.