Openhab Cloud Connector not working anymore after snapshot 1607

Hi,

I have an issue with the cloud connector - last release where it is working with my installation is release #1607,

2019-06-14 08:08:07.941 [ERROR] [io.socket.thread.EventThread        ] - Task threw exception
java.lang.NoClassDefFoundError: okhttp3/Call$Factory
	at io.socket.client.Manager$1.run(Manager.java:277) ~[?:?]
	at io.socket.thread.EventThread.exec(EventThread.java:55) ~[262:io.socket.engine.io-client:1.0.0]
	at io.socket.client.Manager.open(Manager.java:266) ~[?:?]
	at io.socket.client.Manager.open(Manager.java:256) ~[?:?]
	at io.socket.client.Socket$3.run(Socket.java:142) ~[?:?]
	at io.socket.thread.EventThread$2.run(EventThread.java:80) [262:io.socket.engine.io-client:1.0.0]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.ClassNotFoundException: okhttp3.Call$Factory cannot be found by io.socket.engine.io-client_1.0.0
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484) ~[?:?]
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395) ~[?:?]
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387) ~[?:?]
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150) ~[?:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
	... 9 more

Going back to #1607 solves the problem. Is it just me or is anyone else having trouble - I did not find any relevant posts with cloud connector the last couple of days.

Yes same error hereā€¦ Not sure how to fix it yetā€¦

I just updated everything to the latest version yesterday.

Quick question how do I go back to a previous version?

Force reinstall:

sudo apt-get -o Dpkg::Options::="--force-confask" -o Dpkg::Options::="--force-confmiss" install --reinstall openhab2=2.5.0~S1607-1
sudo apt-get -o Dpkg::Options::="--force-confask" -o Dpkg::Options::="--force-confmiss" install --reinstall openhab2-addons=2.5.0~S1607-1

1 Like

Iā€™m having the exact same problem.

Currently on #1611.
Uninstalling the OpenHab Cloud Connector did not work.
Reinstalling OH did not work.

I keep getting:

2019-06-14 18:04:23.205 [ERROR] [io.socket.thread.EventThread        ] - Task threw exception
java.lang.NoClassDefFoundError: okhttp3/Call$Factory
	at io.socket.client.Manager$1.run(Manager.java:277) ~[?:?]
	at io.socket.thread.EventThread.exec(EventThread.java:55) ~[217:io.socket.engine.io-client:1.0.0]
	at io.socket.client.Manager.open(Manager.java:266) ~[?:?]
	at io.socket.client.Manager.open(Manager.java:256) ~[?:?]
	at io.socket.client.Socket$3.run(Socket.java:142) ~[?:?]
	at io.socket.thread.EventThread$2.run(EventThread.java:80) [217:io.socket.engine.io-client:1.0.0]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.ClassNotFoundException: okhttp3.Call$Factory cannot be found by io.socket.engine.io-client_1.0.0
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484) ~[?:?]
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395) ~[?:?]
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387) ~[?:?]
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150) ~[?:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
	... 9 more

Anyone else an idea?

Anybody tried #1613 successfully?
Update: #1614 same issues.

#1615 same issue

1 Like

Unfortunately, todayā€™s 2.5.0~S1616-1 did not fix this issue :(.
Is there any way to report this topic to the developers, as an issue?

Maybe itā€™s caused by PR #5701 @J-N-K?

Iā€˜ll have a look

1 Like

Ok. I found the problem, still looking for a solution. Itā€˜s two-fold. The servicemix-dependencies are not installed because the wrapped other dependencies donā€˜t declare them as required and the second problem is that the okhttp-servicemix imports javax.annotation.meta and the only bundle I found that is exporting that is the jsr305 servicemix but unfortunately that is also exporting javax.annotation which collides with the javax.annotation exported by the okhttp-servicemix.

2 Likes

Thanks for your fast help, it seems it isnā€™t a tipical ā€œitā€™s not a bug, itā€™s a featureā€ like problem, I hope youā€™ll find the solution soon.

Really strange. I just tried to reproduce the problem with an empty karaf container and there it works.

So we better stay with #1607 @J-N-K ?


Apache ServiceMix :: Bundles :: okhttp (241)
okhttp3/Call$Factory.class
openhab> bundle:status 241
Active
openhab> bundle:restart 227
openhab> Exception in thread "EventThread" java.lang.NoClassDefFoundError: okhttp3/Call$Factory
        at io.socket.client.Manager$1.run(Manager.java:277)
        at io.socket.thread.EventThread.exec(EventThread.java:55)
        at io.socket.client.Manager.open(Manager.java:266)
        at io.socket.client.Manager.open(Manager.java:256)
        at io.socket.client.Socket$3.run(Socket.java:142)
        at io.socket.thread.EventThread$2.run(EventThread.java:80)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: okhttp3.Call$Factory cannot be found by io.socket.engine.io-client_1.0.0
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 9 more

Can someone explain to me why this happens? @maggu2810 perhaps? I have no idea why the class is not found. Versions are ok AFAIK,

io.socket/engine.io-client/1.0.0 depends on com.squareup.okhttp3/okhttp/3.8.1 which is exactly the installed version.

Edit: With wrapped versions of the other two bundles it works. Iā€™ll revert the change and re-add it when the osgiify-PR is merged.

Have a look at the package imports. Are you sure the package containing the class is imported?

Archiver-Version: Plexus Archiver
Bnd-LastModified: 1560785409670
Build-Jdk: 1.8.0_92
Built-By: NaoyukiKanezawa
Bundle-ManifestVersion: 2
Bundle-Name: Engine.IO Client
Bundle-SymbolicName: io.socket.engine.io-client
Bundle-Version: 1.0.0
Created-By: 1.8.0_201 (Oracle Corporation)
Export-Package: io.socket.emitter,io.socket.engineio.client;uses:="io.so
 cket.emitter,io.socket.engineio.parser,io.socket.utf8,okhttp3",io.socke
 t.engineio.client.transports;uses:="io.socket.emitter,io.socket.enginei
 o.client,io.socket.engineio.parser,io.socket.utf8,okhttp3",io.socket.en
 gineio.parser;uses:="io.socket.utf8",io.socket.global,io.socket.parseqs
 ,io.socket.thread,io.socket.utf8,io.socket.yeast
Generated-By-Ops4j-Pax-From: wrap:file:/var/lib/openhab2/tmp/mvn/io/sock
 et/engine.io-client/1.0.0/engine.io-client-1.0.0.jar$Bundle-Name=Engine
 .IO%20Client&Bundle-SymbolicName=io.socket.engine.io-client&Bundle-Vers
 ion=1.0.0
Import-Package: okhttp3;resolution:=optional,okio;resolution:=optional,o
 rg.json;resolution:=optional
Originally-Created-By: Apache Maven 3.5.0
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.7))"
Tool: Bnd-2.3.0.201405100607

They are imported. But maybe the problem is that the automatic wrapping done by karaf marks all imports as resolution:="optional" (which is not true for okhttp3). This bundle was installed before and already active when I installed the okhttp3-servicemix. I did not re-resolve the engine.io-client bundle, so maybe it did not pick up the available classes from that bundleā€¦

My osgiified-bundles from my OSGiify-PR properly declare the dependency and therefore itā€™s working. Another reason to get rid of the karaf-wrapping ASAP.

If it is done the way you describe you need to refresh the bundle(s).

It is also possible to use the Karaf wrapping but declare that no import should be optional (thatā€™s just instructions for the wrap logic of Bnd ā€“ yes that one is used in the background).

1 Like

Hello,
Can you let us know when the new image is available for download.

i spend a lot of time getting openhab to work with the cloud connector just to find out it was broken 2 days ago.

i am running it on a synology docker image so i do not see an easy way to roll back to the image version 2 days ago(1607)

thanks

The wrapping changes have been reverted with PR #5743. Thereā€™s now a 2.5.0-SNAPSHOT build #1617 containing these changes. So hopefully the Cloud Connector is working again. :slight_smile:

1 Like

thanks. online now

now i only need to make my devices visible.
tagging part still unclear

1 Like