Hi Paul,

Thank you. Yes, this method works, however, it should also work via the
snippet I've shown below.

At one point this must have worked:

https://github.com/apache/karaf/blob/main/examples/karaf-rest-example/karaf-rest-example-client/karaf-rest-example-client-jersey/src/main/java/org/apache/karaf/examples/rest/client/jersey/AddBookingCommand.java

Thanks for taking a look.

-- 
Chaz

On Wed, Aug 14, 2024 at 07:08:20PM GMT, Paul Spencer wrote:
> Chaz,
> For me the client builder is pass into the component.
> 
> import javax.ws.rs.client.ClientBuilder;
> ...
>     @Reference
>     protected ClientBuilder clientBuilder;
> 
> 
> Paul Spencer
> 
> On 2024/08/14 18:53:37 "apache-karaf-user.pyr3x.com via user" wrote:
> > Hi Paul,
> > 
> > I'm running Karaf 4.4.6. I have no problem hosting a REST service, that
> > is why I brought in the 'aries-jax-rs-whiteboard-jackson' feature. Now I
> > am trying to create a REST client. To do that I'm programming against
> > the JAX-RS 2.1 specification whose implmentation (CXF) should be picked
> > up (it was installed with the feature noted above). The following code
> > snippet produces the error:
> > 
> > final Client client = ClientBuilder.newClient();
> > 
> > I wanted to specifically program against the API rather than the
> > implementation (CXF) for JAX-RS 2.1. Something has gone wrong with
> > the implementation discovery process as a result of creating a new
> > client (namely it can't seem to find the ProviderLocator class).
> > 
> > Can you reproduce this with just the following line above after that
> > feature is installed?
> > 
> > -- 
> > Chaz
> > 
> > On Wed, Aug 14, 2024 at 05:15:46PM GMT, Paul Spencer wrote:
> > > Chaz,
> > > What is version of Karaf you are using?
> > > 
> > > I am using Karaf 4.4.3 to host a REST service that accepts and generated 
> > > JSON payloads, so I know this works with the following features 
> > > installed*.
> > > 
> > > Name                            │ Version
> > > aries-jax-rs-whiteboard         │ 2.0.2
> > > aries-jax-rs-whiteboard-jackson │ 2.0.2
> > > cxf-jackson                     │ 3.5.5
> > > cxf-jaxrs                       │ 3.5.5
> > > jackson                         │ 2.14.1
> > > jackson-jaxrs                   │ 2.14.1
> > > jakarta.annotation              │ 1.3.5
> > > pax-web-jetty                   │ 9.4.50.v2022120
> > > pax-web-whiteboard              │ 8.0.15
> > > 
> > > * The installed feature list may not be complete, as I only listed 
> > > feature that looked relevant.  Also some feature where installed as 
> > > dependencies.  Below is the dependencies for my REST application.
> > > Feature depends on:
> > >  cxf-jaxrs 0.0.0
> > >  jackson-jaxrs 0.0.0
> > >  pax-web-http-whiteboard 0.0.0
> > >  pax-web-karaf 0.0.0
> > >  aries-jax-rs-whiteboard 0.0.0
> > >  aries-jax-rs-whiteboard-jackson 0.0.0
> > > 
> > > 
> > > Paul Spencer
> > > 
> > > 
> > > On 2024/08/14 14:25:40 "apache-karaf-user.pyr3x.com via user" wrote:
> > > > On Tue, Aug 13, 2024 at 07:31:36PM GMT, apache-karaf-user.pyr3x.com via 
> > > > user wrote:
> > > > > Hello,
> > > > > 
> > > > > I'm having an issue creating a javax.ws.rs.client.Client. I'm
> > > > > programming against the Java EE APIs for javax.ws.rs. I've brought in
> > > > > the 'aries-jax-rs-whiteboard-jackson' feature which should ultimately
> > > > > bring in an implementation that can be located. It seems after 
> > > > > googling
> > > > > around that the ProviderLocator was used internally and usually 
> > > > > shaded.
> > > > > At some point this changed, and bringing it in as a depndency manually
> > > > > still fails.
> > > > > 
> > > > > Perhaps this is relevant? 
> > > > > https://issues.apache.org/jira/browse/TOMEE-2690
> > > > > 
> > > > > java.lang.NoClassDefFoundError: 
> > > > > org/apache/geronimo/osgi/locator/ProviderLocator
> > > > >         at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:46) 
> > > > > ~[?:?]
> > > > >         at 
> > > > > javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) 
> > > > > ~[?:?]
> > > > >         at 
> > > > > javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:55) 
> > > > > ~[?:?]
> > > > > 
> > > > > Any help would be appreciated.
> > > > > 
> > > > > --
> > > > > Chaz
> > > > 
> > > > I noticed that the Apache Aries JAX-RS Specification API jar has the
> > > > following header:
> > > > 
> > > > Bundle-ClassPath
> > > >     .,lib/geronimo-osgi-locator.jar
> > > > 
> > > > Could this be causing the issue?
> > > > 
> > > > -- 
> > > > Chaz
> > > > 
> > 
> > 
  • P... apache-karaf-user.pyr3x.com via user
    • ... apache-karaf-user.pyr3x.com via user
      • ... Paul Spencer
        • ... Basheeruddin Ahmed -X (syedbahm - LTIMINDTREE LIMITED at Cisco) via user
        • ... apache-karaf-user.pyr3x.com via user
          • ... Paul Spencer
            • ... apache-karaf-user.pyr3x.com via user

Reply via email to