CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

Alex Weirig

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ...

When I try to create a webclient in my code

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

--

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger

alex_weirig.vcf (348 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

Alex Weirig

BTW:

from my docs it looks like I did that in the past using cxf 3.2.4.

Have there been any significant breaking changes since 3.2.4?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 15:59, Alex Weirig wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ...

When I try to create a webclient in my code

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

--

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM

alex_weirig.vcf (348 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

Tim Ward-2
Have you considered creating the clients as described in the JAX-RS Whiteboard specification (https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#d0e134114)? This avoids the reflective loading pain that you’re hitting in a reliable way.

All the best,

Tim

Sent from my iPhone

On 14 Mar 2020, at 15:05, Alex Weirig <[hidden email]> wrote:

BTW:

from my docs it looks like I did that in the past using cxf 3.2.4.

Have there been any significant breaking changes since 3.2.4?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 15:59, Alex Weirig wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ...

When I try to create a webclient in my code

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

--

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM
<alex_weirig.vcf>
Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

Freeman-2
In reply to this post by Alex Weirig
Hi,

This
javax.ws.rs.client.ClientFinder
is suspicious. Could you please use
find-class javax.ws.rs.client.ClientFinder to see which bundle contains this class?

In CXF, we use Servicemix wrapped jaxrs spec bundle which doesn't use javax.ws.rs.client.ClientFinder at all.

My gut is that somehow you use an incorrect version of jaxrs api bundle in your environment.

Freeman

On Sat, Mar 14, 2020 at 10:59 AM Alex Weirig <[hidden email]> wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ...

When I try to create a webclient in my code

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

--

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

Alex Weirig

Hi Freeman,

thanks for you answer, this is what I'm getting:

find-class javax.ws.rs.client.ClientFinder

login-service (123)
javax/ws/rs/client/ClientFinder.class

Apache CXF Runtime JAX-RS Frontend (171)
javax/ws/rs/client/ClientFinder.class

Apache CXF JAX-RS Client (173)
javax/ws/rs/client/ClientFinder.class


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 16:26, Freeman Fang wrote:
Hi,

This
javax.ws.rs.client.ClientFinder
is suspicious. Could you please use
find-class javax.ws.rs.client.ClientFinder to see which bundle contains this class?

In CXF, we use Servicemix wrapped jaxrs spec bundle which doesn't use javax.ws.rs.client.ClientFinder at all.

My gut is that somehow you use an incorrect version of jaxrs api bundle in your environment.

Freeman

On Sat, Mar 14, 2020 at 10:59 AM Alex Weirig <[hidden email]> wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ...

When I try to create a webclient in my code

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

--

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM

alex_weirig.vcf (348 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

Alex Weirig
In reply to this post by Tim Ward-2

Hi Tim,

thanks for your answer, that was what I was looking at to begin, this was my initial code

        @Reference ClientBuilder clientBuilder;

        Client client = clientBuilder.hostnameVerifier((s, session) -> true)
                                     .sslContext(sslContext)
                                     .register(new JacksonJsonProvider(objectMapper))
                                     .connectTimeout(10, TimeUnit.MINUTES)
                                     .build();

with but then I faced:

Error executing command: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client) Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client)]

I then manually added
bundle:install mvn:javax.ws.rs/javax.ws.rs-api/2.1

and then I got

Error executing command: Error executing command on bundles:
	Error starting bundle 123: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)) 
Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0))]

So at that point I tried to revert to the old code I already and I knew was running back then ...

You had a post back in 2018 about this but it was related to Java 9 ... I'm still on Java 8.

I didn't find anything relevant to this contract issue (except some stuff about Johnzon JSON-B ...



Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 16:20, Tim Ward wrote:
Have you considered creating the clients as described in the JAX-RS Whiteboard specification (https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#d0e134114)? This avoids the reflective loading pain that you’re hitting in a reliable way.

All the best,

Tim

Sent from my iPhone

On 14 Mar 2020, at 15:05, Alex Weirig <[hidden email]> wrote:

BTW:

from my docs it looks like I did that in the past using cxf 3.2.4.

Have there been any significant breaking changes since 3.2.4?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 15:59, Alex Weirig wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ...

When I try to create a webclient in my code

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

--

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM
<alex_weirig.vcf>

alex_weirig.vcf (348 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

Freeman-2
Hi,

Please see my comments inline

On Sat, Mar 14, 2020 at 11:54 AM Alex Weirig <[hidden email]> wrote:

Hi Tim,

thanks for your answer, that was what I was looking at to begin, this was my initial code

        @Reference ClientBuilder clientBuilder;

        Client client = clientBuilder.hostnameVerifier((s, session) -> true)
                                     .sslContext(sslContext)
                                     .register(new JacksonJsonProvider(objectMapper))
                                     .connectTimeout(10, TimeUnit.MINUTES)
                                     .build();

with but then I faced:

Error executing command: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client) Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client)]

I then manually added
This is the problem, shouldn't use this one, should use
mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxrs-api-2.1/2.9.1
which has OSGi locator enabled.


and then I got

Error executing command: Error executing command on bundles:
	Error starting bundle 123: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)) 
Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0))]

So at that point I tried to revert to the old code I already and I knew was running back then ...

You had a post back in 2018 about this but it was related to Java 9 ... I'm still on Java 8.

I didn't find anything relevant to this contract issue (except some stuff about Johnzon JSON-B ...



Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 16:20, Tim Ward wrote:
Have you considered creating the clients as described in the JAX-RS Whiteboard specification (https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#d0e134114)? This avoids the reflective loading pain that you’re hitting in a reliable way.

All the best,

Tim

Sent from my iPhone

On 14 Mar 2020, at 15:05, Alex Weirig <[hidden email]> wrote:

BTW:

from my docs it looks like I did that in the past using cxf 3.2.4.

Have there been any significant breaking changes since 3.2.4?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 15:59, Alex Weirig wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ...

When I try to create a webclient in my code

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

--

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM
<alex_weirig.vcf>
Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

Freeman-2
And for the Provide-Capability requirements, I think we need to release jaxrs-api-2.1 from Servicemix which will contain the fix.
So far you can use the snapshot version of it to give it a quick shot.

Freeman

On Sat, Mar 14, 2020 at 12:00 PM Freeman Fang <[hidden email]> wrote:
Hi,

Please see my comments inline

On Sat, Mar 14, 2020 at 11:54 AM Alex Weirig <[hidden email]> wrote:

Hi Tim,

thanks for your answer, that was what I was looking at to begin, this was my initial code

        @Reference ClientBuilder clientBuilder;

        Client client = clientBuilder.hostnameVerifier((s, session) -> true)
                                     .sslContext(sslContext)
                                     .register(new JacksonJsonProvider(objectMapper))
                                     .connectTimeout(10, TimeUnit.MINUTES)
                                     .build();

with but then I faced:

Error executing command: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client) Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client)]

I then manually added
This is the problem, shouldn't use this one, should use
mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxrs-api-2.1/2.9.1
which has OSGi locator enabled.


and then I got

Error executing command: Error executing command on bundles:
	Error starting bundle 123: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)) 
Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0))]

So at that point I tried to revert to the old code I already and I knew was running back then ...

You had a post back in 2018 about this but it was related to Java 9 ... I'm still on Java 8.

I didn't find anything relevant to this contract issue (except some stuff about Johnzon JSON-B ...



Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 16:20, Tim Ward wrote:
Have you considered creating the clients as described in the JAX-RS Whiteboard specification (https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#d0e134114)? This avoids the reflective loading pain that you’re hitting in a reliable way.

All the best,

Tim

Sent from my iPhone

On 14 Mar 2020, at 15:05, Alex Weirig <[hidden email]> wrote:

BTW:

from my docs it looks like I did that in the past using cxf 3.2.4.

Have there been any significant breaking changes since 3.2.4?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 15:59, Alex Weirig wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ...

When I try to create a webclient in my code

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

--

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM
<alex_weirig.vcf>
Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

Alex Weirig

Hi,

sure whatever helps :-)

I'm finding 2.9.1 in maven. Where could I download the snapshot?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 17:17, Freeman Fang wrote:
And for the Provide-Capability requirements, I think we need to release jaxrs-api-2.1 from Servicemix which will contain the fix.
So far you can use the snapshot version of it to give it a quick shot.

Freeman

On Sat, Mar 14, 2020 at 12:00 PM Freeman Fang <[hidden email]> wrote:
Hi,

Please see my comments inline

On Sat, Mar 14, 2020 at 11:54 AM Alex Weirig <[hidden email]> wrote:

Hi Tim,

thanks for your answer, that was what I was looking at to begin, this was my initial code

        @Reference ClientBuilder clientBuilder;

        Client client = clientBuilder.hostnameVerifier((s, session) -> true)
                                     .sslContext(sslContext)
                                     .register(new JacksonJsonProvider(objectMapper))
                                     .connectTimeout(10, TimeUnit.MINUTES)
                                     .build();

with but then I faced:

Error executing command: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client) Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client)]

I then manually added
bundle:install mvn:javax.ws.rs/javax.ws.rs-api/2.1
This is the problem, shouldn't use this one, should use
mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxrs-api-2.1/2.9.1
which has OSGi locator enabled.


and then I got

Error executing command: Error executing command on bundles:
	Error starting bundle 123: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)) 
Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0))]

So at that point I tried to revert to the old code I already and I knew was running back then ...

You had a post back in 2018 about this but it was related to Java 9 ... I'm still on Java 8.

I didn't find anything relevant to this contract issue (except some stuff about Johnzon JSON-B ...



Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 16:20, Tim Ward wrote:
Have you considered creating the clients as described in the JAX-RS Whiteboard specification (https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#d0e134114)? This avoids the reflective loading pain that you’re hitting in a reliable way.

All the best,

Tim

Sent from my iPhone

On 14 Mar 2020, at 15:05, Alex Weirig <[hidden email]> wrote:

BTW:

from my docs it looks like I did that in the past using cxf 3.2.4.

Have there been any significant breaking changes since 3.2.4?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 15:59, Alex Weirig wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ...

When I try to create a webclient in my code

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

--

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM
<alex_weirig.vcf>

alex_weirig.vcf (348 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

jbonofre
Hi,

I will publish a SNAPSHOT as I will cut the ServiceMix release.

Regards
JB

Le 14 mars 2020 à 17:29, Alex Weirig <[hidden email]> a écrit :

Hi,

sure whatever helps :-)

I'm finding 2.9.1 in maven. Where could I download the snapshot?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 17:17, Freeman Fang wrote:
And for the Provide-Capability requirements, I think we need to release jaxrs-api-2.1 from Servicemix which will contain the fix. 
So far you can use the snapshot version of it to give it a quick shot.

Freeman

On Sat, Mar 14, 2020 at 12:00 PM Freeman Fang <[hidden email]> wrote:
Hi,

Please see my comments inline

On Sat, Mar 14, 2020 at 11:54 AM Alex Weirig <[hidden email]> wrote:

Hi Tim,

thanks for your answer, that was what I was looking at to begin, this was my initial code

        @Reference ClientBuilder clientBuilder;

        Client client = clientBuilder.hostnameVerifier((s, session) -> true)
                                     .sslContext(sslContext)
                                     .register(new JacksonJsonProvider(objectMapper))
                                     .connectTimeout(10, TimeUnit.MINUTES)
                                     .build();

with but then I faced:

Error executing command: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client) Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client)]

I then manually added 
This is the problem, shouldn't use this one, should use 
mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxrs-api-2.1/2.9.1
which has OSGi locator enabled.


and then I got

Error executing command: Error executing command on bundles:
	Error starting bundle 123: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)) 
Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0))]

So at that point I tried to revert to the old code I already and I knew was running back then ...

You had a post back in 2018 about this but it was related to Java 9 ... I'm still on Java 8.

I didn't find anything relevant to this contract issue (except some stuff about Johnzon JSON-B ...



Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 16:20, Tim Ward wrote:
Have you considered creating the clients as described in the JAX-RS Whiteboard specification (https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#d0e134114)? This avoids the reflective loading pain that you’re hitting in a reliable way.

All the best,

Tim

Sent from my iPhone

On 14 Mar 2020, at 15:05, Alex Weirig <[hidden email]> wrote:

BTW:

from my docs it looks like I did that in the past using cxf 3.2.4.

Have there been any significant breaking changes since 3.2.4?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 15:59, Alex Weirig wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo 

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ... 

When I try to create a webclient in my code 

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

-- 

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM
<alex_weirig.vcf>
<alex_weirig.vcf>

Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

Alex Weirig

Hi JB,

will I be able to follow that process?

Thanks


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 17:46, Jean-Baptiste Onofre wrote:
Hi,

I will publish a SNAPSHOT as I will cut the ServiceMix release.

Regards
JB

Le 14 mars 2020 à 17:29, Alex Weirig <[hidden email]> a écrit :

Hi,

sure whatever helps :-)

I'm finding 2.9.1 in maven. Where could I download the snapshot?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" class="" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 17:17, Freeman Fang wrote:
And for the Provide-Capability requirements, I think we need to release jaxrs-api-2.1 from Servicemix which will contain the fix. 
So far you can use the snapshot version of it to give it a quick shot.

Freeman

On Sat, Mar 14, 2020 at 12:00 PM Freeman Fang <[hidden email]> wrote:
Hi,

Please see my comments inline

On Sat, Mar 14, 2020 at 11:54 AM Alex Weirig <[hidden email]> wrote:

Hi Tim,

thanks for your answer, that was what I was looking at to begin, this was my initial code

        @Reference ClientBuilder clientBuilder;

        Client client = clientBuilder.hostnameVerifier((s, session) -> true)
                                     .sslContext(sslContext)
                                     .register(new JacksonJsonProvider(objectMapper))
                                     .connectTimeout(10, TimeUnit.MINUTES)
                                     .build();

with but then I faced:

Error executing command: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client) Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client)]

I then manually added 
bundle:install mvn:javax.ws.rs/javax.ws.rs-api/2.1
This is the problem, shouldn't use this one, should use 
mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxrs-api-2.1/2.9.1
which has OSGi locator enabled.


and then I got

Error executing command: Error executing command on bundles:
	Error starting bundle 123: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)) 
Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0))]

So at that point I tried to revert to the old code I already and I knew was running back then ...

You had a post back in 2018 about this but it was related to Java 9 ... I'm still on Java 8.

I didn't find anything relevant to this contract issue (except some stuff about Johnzon JSON-B ...



Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 16:20, Tim Ward wrote:
Have you considered creating the clients as described in the JAX-RS Whiteboard specification (https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#d0e134114)? This avoids the reflective loading pain that you’re hitting in a reliable way.

All the best,

Tim

Sent from my iPhone

On 14 Mar 2020, at 15:05, Alex Weirig <[hidden email]> wrote:

BTW:

from my docs it looks like I did that in the past using cxf 3.2.4.

Have there been any significant breaking changes since 3.2.4?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 15:59, Alex Weirig wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo 

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ... 

When I try to create a webclient in my code 

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

-- 

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM
<alex_weirig.vcf>
<alex_weirig.vcf>


alex_weirig.vcf (348 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

jbonofre
It’s done for the SNAPSHOT.

By the way, you can create your own workaround by creating (or adding on existing) feature containing the capability (you have feature:capability-add command to do that).

Regards
JB

Le 14 mars 2020 à 21:12, Alex Weirig <[hidden email]> a écrit :

Hi JB,

will I be able to follow that process?

Thanks


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
 
schaufel.besten.kopie
 
supposons.levage.venger
On 14/03/2020 17:46, Jean-Baptiste Onofre wrote:
Hi,

I will publish a SNAPSHOT as I will cut the ServiceMix release.

Regards
JB

Le 14 mars 2020 à 17:29, Alex Weirig <[hidden email]> a écrit :

Hi,

sure whatever helps :-)

I'm finding 2.9.1 in maven. Where could I download the snapshot?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" class="" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
 
schaufel.besten.kopie
 
supposons.levage.venger
On 14/03/2020 17:17, Freeman Fang wrote:
And for the Provide-Capability requirements, I think we need to release jaxrs-api-2.1 from Servicemix which will contain the fix. 
So far you can use the snapshot version of it to give it a quick shot.

Freeman

On Sat, Mar 14, 2020 at 12:00 PM Freeman Fang <[hidden email]> wrote:
Hi,

Please see my comments inline

On Sat, Mar 14, 2020 at 11:54 AM Alex Weirig <[hidden email]> wrote:

Hi Tim,

thanks for your answer, that was what I was looking at to begin, this was my initial code

        @Reference ClientBuilder clientBuilder;

        Client client = clientBuilder.hostnameVerifier((s, session) -> true)
                                     .sslContext(sslContext)
                                     .register(new JacksonJsonProvider(objectMapper))
                                     .connectTimeout(10, TimeUnit.MINUTES)
                                     .build();

with but then I faced:

Error executing command: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client) Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client)]

I then manually added 
This is the problem, shouldn't use this one, should use 
mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxrs-api-2.1/2.9.1
which has OSGi locator enabled.


and then I got

Error executing command: Error executing command on bundles:
	Error starting bundle 123: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)) 
Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0))]

So at that point I tried to revert to the old code I already and I knew was running back then ...

You had a post back in 2018 about this but it was related to Java 9 ... I'm still on Java 8.

I didn't find anything relevant to this contract issue (except some stuff about Johnzon JSON-B ...



Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 16:20, Tim Ward wrote:
Have you considered creating the clients as described in the JAX-RS Whiteboard specification (https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#d0e134114)? This avoids the reflective loading pain that you’re hitting in a reliable way.

All the best,

Tim

Sent from my iPhone

On 14 Mar 2020, at 15:05, Alex Weirig <[hidden email]> wrote:

BTW:

from my docs it looks like I did that in the past using cxf 3.2.4.

Have there been any significant breaking changes since 3.2.4?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 15:59, Alex Weirig wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo 

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ... 

When I try to create a webclient in my code 

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

-- 

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM
<alex_weirig.vcf>
<alex_weirig.vcf>

<alex_weirig.vcf>

Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

jbonofre
Hmmm, let me double check if the SMX Specs JAXRS bundle is OK in meantime.

Regards
JB

Le 15 mars 2020 à 06:10, Jean-Baptiste Onofre <[hidden email]> a écrit :

It’s done for the SNAPSHOT.

By the way, you can create your own workaround by creating (or adding on existing) feature containing the capability (you have feature:capability-add command to do that).

Regards
JB

Le 14 mars 2020 à 21:12, Alex Weirig <[hidden email]> a écrit :

Hi JB,

will I be able to follow that process?

Thanks


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
 
schaufel.besten.kopie
 
supposons.levage.venger
On 14/03/2020 17:46, Jean-Baptiste Onofre wrote:
Hi,

I will publish a SNAPSHOT as I will cut the ServiceMix release.

Regards
JB

Le 14 mars 2020 à 17:29, Alex Weirig <[hidden email]> a écrit :

Hi,

sure whatever helps :-)

I'm finding 2.9.1 in maven. Where could I download the snapshot?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" class="" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
 
schaufel.besten.kopie
 
supposons.levage.venger
On 14/03/2020 17:17, Freeman Fang wrote:
And for the Provide-Capability requirements, I think we need to release jaxrs-api-2.1 from Servicemix which will contain the fix. 
So far you can use the snapshot version of it to give it a quick shot.

Freeman

On Sat, Mar 14, 2020 at 12:00 PM Freeman Fang <[hidden email]> wrote:
Hi,

Please see my comments inline

On Sat, Mar 14, 2020 at 11:54 AM Alex Weirig <[hidden email]> wrote:

Hi Tim,

thanks for your answer, that was what I was looking at to begin, this was my initial code

        @Reference ClientBuilder clientBuilder;

        Client client = clientBuilder.hostnameVerifier((s, session) -> true)
                                     .sslContext(sslContext)
                                     .register(new JacksonJsonProvider(objectMapper))
                                     .connectTimeout(10, TimeUnit.MINUTES)
                                     .build();

with but then I faced:

Error executing command: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client) Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client)]

I then manually added 
This is the problem, shouldn't use this one, should use 
mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxrs-api-2.1/2.9.1
which has OSGi locator enabled.


and then I got

Error executing command: Error executing command on bundles:
	Error starting bundle 123: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)) 
Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0))]

So at that point I tried to revert to the old code I already and I knew was running back then ...

You had a post back in 2018 about this but it was related to Java 9 ... I'm still on Java 8.

I didn't find anything relevant to this contract issue (except some stuff about Johnzon JSON-B ...



Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 16:20, Tim Ward wrote:
Have you considered creating the clients as described in the JAX-RS Whiteboard specification (https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#d0e134114)? This avoids the reflective loading pain that you’re hitting in a reliable way.

All the best,

Tim

Sent from my iPhone

On 14 Mar 2020, at 15:05, Alex Weirig <[hidden email]> wrote:

BTW:

from my docs it looks like I did that in the past using cxf 3.2.4.

Have there been any significant breaking changes since 3.2.4?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 15:59, Alex Weirig wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo 

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ... 

When I try to create a webclient in my code 

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

-- 

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM
<alex_weirig.vcf>
<alex_weirig.vcf>

<alex_weirig.vcf>


Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

Alex Weirig
In reply to this post by jbonofre

Dear all,

I solved the problem by taken the base specs-jaxrs-api bundle from servicemix and by editing the MANIFEST and adding a Provide-Capability.

Then simply deploy the whiteboard bundles and now everything is working.

Thanks for your support on a weekend


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 17:46, Jean-Baptiste Onofre wrote:
Hi,

I will publish a SNAPSHOT as I will cut the ServiceMix release.

Regards
JB

Le 14 mars 2020 à 17:29, Alex Weirig <[hidden email]> a écrit :

Hi,

sure whatever helps :-)

I'm finding 2.9.1 in maven. Where could I download the snapshot?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" class="" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 17:17, Freeman Fang wrote:
And for the Provide-Capability requirements, I think we need to release jaxrs-api-2.1 from Servicemix which will contain the fix. 
So far you can use the snapshot version of it to give it a quick shot.

Freeman

On Sat, Mar 14, 2020 at 12:00 PM Freeman Fang <[hidden email]> wrote:
Hi,

Please see my comments inline

On Sat, Mar 14, 2020 at 11:54 AM Alex Weirig <[hidden email]> wrote:

Hi Tim,

thanks for your answer, that was what I was looking at to begin, this was my initial code

        @Reference ClientBuilder clientBuilder;

        Client client = clientBuilder.hostnameVerifier((s, session) -> true)
                                     .sslContext(sslContext)
                                     .register(new JacksonJsonProvider(objectMapper))
                                     .connectTimeout(10, TimeUnit.MINUTES)
                                     .build();

with but then I faced:

Error executing command: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client) Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client)]

I then manually added 
bundle:install mvn:javax.ws.rs/javax.ws.rs-api/2.1
This is the problem, shouldn't use this one, should use 
mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxrs-api-2.1/2.9.1
which has OSGi locator enabled.


and then I got

Error executing command: Error executing command on bundles:
	Error starting bundle 123: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)) 
Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0))]

So at that point I tried to revert to the old code I already and I knew was running back then ...

You had a post back in 2018 about this but it was related to Java 9 ... I'm still on Java 8.

I didn't find anything relevant to this contract issue (except some stuff about Johnzon JSON-B ...



Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 16:20, Tim Ward wrote:
Have you considered creating the clients as described in the JAX-RS Whiteboard specification (https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#d0e134114)? This avoids the reflective loading pain that you’re hitting in a reliable way.

All the best,

Tim

Sent from my iPhone

On 14 Mar 2020, at 15:05, Alex Weirig <[hidden email]> wrote:

BTW:

from my docs it looks like I did that in the past using cxf 3.2.4.

Have there been any significant breaking changes since 3.2.4?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 15:59, Alex Weirig wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo 

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ... 

When I try to create a webclient in my code 

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

-- 

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM
<alex_weirig.vcf>
<alex_weirig.vcf>


alex_weirig.vcf (348 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: CNF javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50)

jbonofre
Hi,

Thanks for the update. I will release servicemix-sepcs (including jaxrs-api 2.1 spec bundle) this week.

Regards
JB

Le 15 mars 2020 à 10:54, Alex Weirig <[hidden email]> a écrit :

Dear all,

I solved the problem by taken the base specs-jaxrs-api bundle from servicemix and by editing the MANIFEST and adding a Provide-Capability.

Then simply deploy the whiteboard bundles and now everything is working.

Thanks for your support on a weekend


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
 
schaufel.besten.kopie
 
supposons.levage.venger
On 14/03/2020 17:46, Jean-Baptiste Onofre wrote:
Hi,

I will publish a SNAPSHOT as I will cut the ServiceMix release.

Regards
JB

Le 14 mars 2020 à 17:29, Alex Weirig <[hidden email]> a écrit :

Hi,

sure whatever helps :-)

I'm finding 2.9.1 in maven. Where could I download the snapshot?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" class="" moz-do-not-send="true">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
 
schaufel.besten.kopie
 
supposons.levage.venger
On 14/03/2020 17:17, Freeman Fang wrote:
And for the Provide-Capability requirements, I think we need to release jaxrs-api-2.1 from Servicemix which will contain the fix. 
So far you can use the snapshot version of it to give it a quick shot.

Freeman

On Sat, Mar 14, 2020 at 12:00 PM Freeman Fang <[hidden email]> wrote:
Hi,

Please see my comments inline

On Sat, Mar 14, 2020 at 11:54 AM Alex Weirig <[hidden email]> wrote:

Hi Tim,

thanks for your answer, that was what I was looking at to begin, this was my initial code

        @Reference ClientBuilder clientBuilder;

        Client client = clientBuilder.hostnameVerifier((s, session) -> true)
                                     .sslContext(sslContext)
                                     .register(new JacksonJsonProvider(objectMapper))
                                     .connectTimeout(10, TimeUnit.MINUTES)
                                     .build();

with but then I faced:

Error executing command: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client) Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.wiring.package; (osgi.wiring.package=javax.ws.rs.client)]

I then manually added 
This is the problem, shouldn't use this one, should use 
mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxrs-api-2.1/2.9.1
which has OSGi locator enabled.


and then I got

Error executing command: Error executing command on bundles:
	Error starting bundle 123: Unable to resolve lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2): missing requirement [lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)) 
Unresolved requirements: [[lu.tlk.occupation_postes_electronique.services.login-service [123](R 123.2)] osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0))]

So at that point I tried to revert to the old code I already and I knew was running back then ...

You had a post back in 2018 about this but it was related to Java 9 ... I'm still on Java 8.

I didn't find anything relevant to this contract issue (except some stuff about Johnzon JSON-B ...



Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 16:20, Tim Ward wrote:
Have you considered creating the clients as described in the JAX-RS Whiteboard specification (https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#d0e134114)? This avoids the reflective loading pain that you’re hitting in a reliable way.

All the best,

Tim

Sent from my iPhone

On 14 Mar 2020, at 15:05, Alex Weirig <[hidden email]> wrote:

BTW:

from my docs it looks like I did that in the past using cxf 3.2.4.

Have there been any significant breaking changes since 3.2.4?


Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
On 14/03/2020 15:59, Alex Weirig wrote:

Hi,

I'm trying to develop a JAX-RS client on karaf 4.2.8.

I've installed the usual suspects:

feature:install scr webconsole

and I've added the cxf repo 

cxf-3.3.5                         │ mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features

and installed following features:

feature:install cxf-jaxrs cxf-core cxf-commands cxf-http-client cxf-jackson

and I've installed my bundles. Everything is starting up as expected ... 

When I try to create a webclient in my code 

        Client client = ClientBuilder.newBuilder().hostnameVerifier((s, session) -> true)
                                           .sslContext(sslContext)
                                           .register(new JacksonJsonProvider(objectMapper))
                                           .connectTimeout(10, TimeUnit.MINUTES)
                                           .build();

I get a CNF exception.

java.lang.RuntimeException: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:50) ~[?:?]
        at tlk.occupation_postes_electronique.services.login_service.impl.LoginServiceImpl.authenticate(LoginServiceImpl.java:92) ~[?:?]
        at lu.tlk.occupation_postes_electronique.services.login_service_test.cmd.LoginServiceTestCommands.testLogin(LoginServiceTestCommands.java:22) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:143) ~[?:?]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.CommandTracker$1.execute(CommandTracker.java:112) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:120) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more
Caused by: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:1.8.0_212]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
        at javax.ws.rs.client.ClientFinder.newInstance(ClientFinder.java:116) ~[?:?]
        at javax.ws.rs.client.ClientFinder.find(ClientFinder.java:96) ~[?:?]
        at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:44) ~[?:?]
        ... 21 more

I'm pretty sure I had something similar running in an older version of karaf but I can't figure out what I'm missing today...

Many thanks in advance

-- 

Mat frëndleche Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg
Service Enseignement
Centre Technolink

Tel <a href="tel:+35247966127" target="_blank" moz-do-not-send="true" class="">+352 4796 - 6127
Fax +352 42 88 81
Email [hidden email]
www.vdl.lu // www.technolink.lu

Centre Technolink
2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

indoors.this.blesses
schaufel.besten.kopie
supposons.levage.venger
-- 
This email was Anti Virus checked by SOPHOS UTM
<alex_weirig.vcf>
<alex_weirig.vcf>

<alex_weirig.vcf>