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: Thu, 10 Oct 2024 13:21:37 +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=Ct/VI02DCi5eZucNJAyKpcUGsVQaEWr1ouUvq/MDWpA=; b=JjVwHQzM2skyh3HWHv3u8hi8976/Ihc01tUqYWde3RYe6uxVkKXF3t4Ncf8G9v3G6hNd7hlUDAd5kNJRVUHTiuwCY7CGdD1YzOqB/pB6vW7GwjCEZKHcfi2dhHqsD1msFuryiYjKhZL9I6j9SrgQlOgxw9f8Ey1ZmhSiKCjPlnXOF/MxWzY/aFeULW9BWpJjeRHWzYmHR5e3LabZlvOsKtzAzkhCNWxnpmaqu31Qxfhwdi7e089nGc5HedvrjVrylkVysSDkYOcx/ff7NL9loSejQaEhoOTzbi5DkwNVH4/Ar5i66ePNRQZYQ3RUbZ7qk8PmAytK3+AYpbQz30ZClA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SGe042zd7gAvUNld/4pQ1Vaovs+sCM7gyXw9KHH9XyJJaauyGcMZpU/E66juNBkvFK1Z6GjvzR6UYbcExO2jSOlHuMkBqRlM+cpxsjOhtVCIwPHoCi6Pfu+Kn1wQm3i/aJUGm0dYaSEjU5NX9xuFEV/KlFxW8OaSwyZNNDqiY8t7tAPdwsDSOLzUEGOyb7S50Ifk2SLP0AiUCnZbmKY3YGEIgSgd7T+abSGprhO12Gh2FOf0p/PaMabcY1swY5Egb9KNH+eF9eYpsFFOcg4H9z4p6z9uPK/cAs/RtasKlsl5J2/iKDSn46LkFMgkMMBt+xDS3a6ykSLuM0A+JzJuig==
  • 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: AQHbGwBWXMEn+kqh0EaT8PhL2FQ+3LJ/+FEC
  • Thread-topic: [External] : [jersey-dev] support request for using ApacheConnectorProvider to connect via proxy

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/


Back to the top