Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jersey-dev] [External] : support request for using ApacheConnectorProvider to connect via proxy
  • From: Jan Supol <jan.supol@xxxxxxxxxx>
  • Date: Mon, 14 Oct 2024 19:35:42 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bp+9IM+Wn/S99LSBQQ1zg/EcIrIc9LABEmMnoYU6cWY=; b=M/wTmPoG4T3TDu4jPOE1s7Tpy8N4l+5YI16XC06BAcELsHFnoGkfK+evITKuDlBbj694YAi57G6okn2Av93Umq042ky/Zk5NPWW7WSzqsBQvPzLQlVMhXm4nH+n3XSGsw6forkCrWYzM1dsz2m08P3sGrS7XN7PKJs0gtiRFkcAekFJaQvckS/LXB0MWyXg7GMbUPv3hbHgoalVKBYTfTXDu5NmbF1X+W50f8rbkOwQ4aeo3CBbKmIiWtiaqaX0I5O7oUM652HqkKzejUpbmOZHFX8NIXj+h2TnWgZKZtbwtIU3J7nZ/wlspoXOf2LHJXRKwacuN3tK68+X4WmEQdg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UnfPcmoanKW5VSHZEj/9a4ly8nRDUCMHn8i+F560UZEfKOMwxyNfD/TPhzlSTtpAbUsom8MgsYKejMAnyYQS2ODXGHxdEsTCOnFrk6aeAMXynuzfxdxvvcy52TamqJyNwFhHQHrKsk3taY94BRisQ3Lr04PAfIrdb3Ma3XnSeKqrSbCFrbPwEJDVR4V7v43K/Xa9sfeqcr3q1Znp7Rt+j/qZiErITCUzcxqltafds4wJqirZzeuA2kon3B+wSXZUzeM9PlDP13PpjalJMQbWoebc4/GRNEXQkoXZY0dmbkf+duOfDN+vJk1rCHRezw4BPLWPgE3ZXSAWQR+M02xSrQ==
  • Delivered-to: jersey-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/jersey-dev/>
  • List-help: <mailto:jersey-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/jersey-dev>, <mailto:jersey-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/jersey-dev>, <mailto:jersey-dev-request@eclipse.org?subject=unsubscribe>
  • Msip_labels:
  • Thread-index: AQHbGyQVz+exN1nCJUedAeKpWS7h87KGpTcS
  • Thread-topic: [jersey-dev] [External] : support request for using ApacheConnectorProvider to connect via proxy

Hi,
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.

--Jan

From: jersey-dev <jersey-dev-bounces@xxxxxxxxxxx> on behalf of Ivano Luberti via jersey-dev <jersey-dev@xxxxxxxxxxx>
Sent: Thursday, October 10, 2024 4:51 PM
To: jersey-dev@xxxxxxxxxxx <jersey-dev@xxxxxxxxxxx>
Cc: Ivano Luberti <luberti@xxxxxxxxxxxx>
Subject: Re: [jersey-dev] [External] : support request for using ApacheConnectorProvider to connect via proxy
 

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


From: jersey-dev <jersey-dev-bounces@xxxxxxxxxxx> on behalf of Ivano Luberti via jersey-dev <jersey-dev@xxxxxxxxxxx>
Sent: Thursday, October 10, 2024 12:36 PM
To: jersey-dev@xxxxxxxxxxx <jersey-dev@xxxxxxxxxxx>
Cc: Ivano Luberti <luberti@xxxxxxxxxxxx>
Subject: [External] : [jersey-dev] support request for using ApacheConnectorProvider to connect via proxy
 

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/


Back to the top