1

I wrote a Liferay 7 module that uses org.apache.http.client.methods.HttpPost.

So I downloaded the httpclient-osgi JAR and put it in deploy/, but when I try to start it I get:

org.osgi.framework.BundleException: Could not resolve module: org.apache.httpcomponents.httpclient [1088]
  Unresolved requirement: Import-Package: org.apache.http; version="[4.4.0,4.5.0)"

So I searched mvnrepository.com for org.apache.http.
PROBLEM: No such component seems to exist.

Do I have no other option than including the classes inside my Liferay module?
Doing so sounds contrary to the OSGi principles: if my 100 Liferay modules use httpclient then including httpclient in each of them does not sound very modular.

Am I thinking the wrong way?
How to use a third-party component in a modular way in Liferay?

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
  • [org.apache.http](https://stackoverflow.com/questions/1932321/where-can-i-download-the-jar-for-org-apache-http-package) – LazerBanana Jul 19 '17 at 09:12
  • @LazerBanana: Your link directs to a question whose accepted answer is a link that redirects to the list of all software Apache has ever released: https://www-eu.apache.org/dist/ By the way, most of the JARs in that tree are probably not OSGi components. – Nicolas Raoul Jul 19 '17 at 09:17

1 Answers1

2

What you are searching for is a package name not a jar name. Apache httpclient needs httpcore.

These bundles are known to work well together:

mvn:org.apache.httpcomponents/httpclient-osgi/4.5.3
mvn:org.apache.httpcomponents/httpcore-osgi/4.4.6

https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient-osgi/4.5.3
https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore-osgi/4.4.6

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
Christian Schneider
  • 19,420
  • 2
  • 39
  • 64