How to solve org.osgi.framework.BundleException in demo.app

Tags: #<Tag:0x00007f5c90104ea8> #<Tag:0x00007f5c90104db8>

Hi,
I’m trying to develop a new binding. For testing and debugging I’m using the org.openhab.demo.app.

Once added dependencies to pom.xml and added my repo to requirements I get the error when launching.

! org.osgi.framework.FrameworkEvent[source=org.openhab.binding.linktap_2.5.4.202005011523 [136]]
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.linktap [136]
Unresolved requirement: Import-Package: org.apache.http

I’m using those import in my class manage a REST call to the linktap api.

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;

Is there an option to resolve the error?

Thanks,
becksen

Don‘t really know how to solv this dependency issue, but you should use


org.eclipse.jetty.client.HttpClient;

instead of apache.

Might be that your version is not correct. Actually you should build against 2.5.5

1 Like

Hi hmerk,

thanks for your reply. I haven’t found the same capabilities of

org.eclipse.jetty.client.HttpClient;

so far as in org.apache.http. But I’ll have a look at it if I can use it. In addition building against 2.5.5 makes sense, but how to I get upgraded my git project as well as the demo.app to 2.5.5.

Best regards,

You should have two repos in your workspace, openhab2-addons and openhab-distro. In addons repo, you should have several branches, one would be your feature branch, one called 2.5.5
Sync the 2.5.5 branch with the openhab/openhab2-addons branch and then rebase your feature branch against 2.5.5 branch. Dont forget to update your pom to 2.5.5
For the distro, just pull actual changes.

1 Like

org.eclipse.jetty.client.HttpClient does not provide what is required. Instead I’ve identified okhttp3 which is perfect for the needs.

Also update the POM file:

<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>okhttp</artifactId>
    <version>4.6.0</version>
</dependency>

But again the same error :frowning:

! org.osgi.framework.FrameworkEvent[source=org.openhab.binding.linktap_2.5.4.202005031652 [136]]
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.linktap [136]
  Unresolved requirement: Import-Package: okhttp3

Maybe it is an eclipse issue, but VSCode seems not be an alternative currently. Any ideas how to get the unresolved dependencies resolved?

I’ve just observed that my openhab2-addons repo might be wrongly configured right?

Origin:
fetch:  https://github.com/openhab/openhab-addons.git
push: https://github.com/becksen/openhab-addons-1.git

upstream:
fetch: https://github.com/becksen/openhab-addons-1.git
push: https://github.com/becksen/openhab-addons-1.git

Can’t find a 2.5.5 branch in the repo.

Regards,
Timmy