First of all, I'd like to discourage you from starting with Jersey 2.25.1 which is from 2016, i.e. 8 years old now. Chances are that once something does not work for you, it has been fixed within these 8 years.
Second, this NoClassDefFoundError you likely get because there are no Apache dependencies on your classpath. The jersey-apache-connector is just a bridge between JAX-RS/Jersey and the Apache HTTP client.
Within those 8 years, Apache also stopped developing the Apache 4 HTTP Client and they now work on Apache 5 HTTP Client, which is supported by Jersey jersey-apache5-connector module. While your question sound like you are starting a project, you may think
about using the more modern Apache 5 HTTP client. Of course. the old Apache 4 HTTP Client can still be used with the jersey-apache-connector.
If you have any further question, you may also consider asking on Stack Overflow, which has more audience than Jersey mailing list. Also, you may use Jersey issue tracker on GitHub.
Hi, I guess this is not the appropriate place to post this request but I have not been able to find the right place.
So please if the request is not appropiate point me to the right place.
I have a Jersey client properly working but I'm struggling to use it to connect via a proxy.
Using documentation
https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/user-guide.html#client
and stackoverflow I have been led to guess that I have to use ApacheConnectorProvider
So I have added to the configuration of the client these two lines
configuration.connectorProvider(new ApacheConnectorProvider());
configuration =
configuration.property(ClientProperties.PROXY_URI,
"localhost:8000");
(I need proxy for debugging purposes, not production)
Of course I have added
jersey-apache-connector-2.25.1.jar
to the classpath.
When I run the client I get this exception
java.lang.NoClassDefFoundError: org/apache/http/protocol/HttpContext
org.glassfish.jersey.apache.connector.ApacheConnectorProvider.getConnector(ApacheConnectorProvider.java:115)
org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:425)
org.glassfish.jersey.client.ClientConfig$State.access$000(ClientConfig.java:90)
org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:122)
org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:119)
org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:340)
org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:733)
org.glassfish.jersey.client.ClientRequest.getConfiguration(ClientRequest.java:286)
org.glassfish.jersey.client.JerseyInvocation.validateHttpMethodAndEntity(JerseyInvocation.java:135)
org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:105)
org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:101)
org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:92)
org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:437)
org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:343)
TIA for any suggestion
--
Archimede Informatica tratta i dati personali in conformità a quanto
stabilito dal Regolamento UE n. 2016/679 (GDPR) e dal D. Lgs. 30 giugno 2003 n. 196
per come modificato dal D.Lgs. 10 agosto 2018 n. 101.
Informativa completa
Il contenuto di questo messaggio e dei suoi eventuali allegati è riservato. Nel caso in cui Lei non sia il destinatario, La preghiamo di contattare telefonicamente o via e-mail il mittente ai recapiti sopra indicati
e di cancellare il messaggio e gli eventuali allegati dal Suo sistema senza farne copia o diffonderli. Le opinioni espresse sono quelle dell'autore e non rappresentano necessariamente quelle della Società.
This message and any attachment are confidential.If you are not the intended recipient, please telephone or email the sender and delete this message and any attachment from your system. If you are not the intended recipient you must not copy this message or
attachment or disclose the contents to any other person. Any opinions presented are solely those of the author and do not necessarily represent those of the Company.
dott. Ivano Mario Luberti
Archimede Informatica società cooperativa a r. l.
Via Gereschi 36, 56127 Pisa
tel.: +39 050/580959
web:
www.archicoop.it
linkedin:
www.linkedin.com/in/ivanoluberti
facebook:
www.facebook.com/archimedeinformaticapisa/