Jersey 2.25.1 had working with Apache Client 4.5, but not
properly with 4.5.1+. There were some changes in the Apache HTTP
Client that caused us troubles when fixing it later. From the
top of my head I do not remember if there were just certain
cases (SSE) which did not work or it did not work at all. But I
would not go beyond HTTP Client 4.5.
The same with Jetty (client). Jersey 2.x supports Jetty 9, 3.0.x
Jetty 11, and Jetty 12 is supported just by the latest Jersey
3.1.x/4.0.
Also, JDK 9+ is not tested with Jersey 2.25.1. I am sure Jersey
server 2.25.1 does not work with JDK 9+, not sure about the
client.
For the ClassNotFound/NoClassDefFound the java -Xdiag or java
-verbose:class can give more hints about what is going on if
some hidden issue.
If you have a reproducer, feel free to file an issue to GitHub
Jersey issue tracker.
Hi Jan, thanks for your quick polite and sensible answer.
First of all I have already tried stackoferlow searching for
a solution and also asking for my specific issue but I have go
no answer so far.
Second I'm not starting a project really but I have to
develop a web service client that will be used in an already
existent web application that has its own dependencies and in
particular there is already another jersey client implemented
with jersey 2.25.1
I have your same concerns, of course.
I had also tried Jersey 2.45 but I encountered the same
issue.
With respect to your observation about
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.
This is what I understood from documentation so I had already
tried to add
httpclient-4.5.14.jar
to the WEB-INF/lib directory but to no avail
I tried also using the jersey-jetty-connector-2.25.1 coupled
with jetty-client-12.0.4.jar
Also in this case I get a
java.lang.NoClassDefFoundError
on another class of course.
So it seems there is a class loading issue
I'm using Apache Tomcat 9 and JDK 8.
Il 10-Oct-24 15:21, Jan Supol via
jersey-dev ha scritto:
Hi,
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.
Hope this helps,
Jan
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/
_______________________________________________
jersey-dev mailing list
jersey-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jersey-dev
--
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/