MQTT and OH2 - not working

Hi, is there any possibility to add binding for MQTT. I’ve checked old OH1.x version but it isn’t working at all. I see in logs: 2015-08-14 00:56:02 [DEBUG] [.io.transport.mqtt.MqttService:118 ] - Starting MQTT Service…, I’ve copied openhab.cfg from OH1.x to services and added item to test.items. Same configuration in OH1.x is working.
-Marcin

It should work, see @kgoderis’ post at https://groups.google.com/d/msg/openhab2/ZcuBBV_rhNg/yMG5meXebGcJ

Kai,
MQTT binding is not working at all. I’ve did everithing what Kgoderis wrote. I’ve checked this with newest OH2 version. Even I’ve copied mqtt binding jar to addons directory binding hasn’t start. I’ve also checked this with older version from 26-07-15 binding start but messages are not sent to the mosquitto broker. The difference between this two releases is file runtime/server/plugins/org.openhab.io.transport.mqtt_1.8.0.201507260113.jar which is not included in newest release.

With OH1.x everything is working fine.

I had tested the mqtt stuff days after the initial alpha 1 release. It did work at the time

Most probably it need retesting with the latest 1.8 mqtt binding and latest alpha2. I currently have the mqtt not in my operational environment so I can not confirm the actual state of things

K

You do need the transport bundle. If not in the server folder then you need to copy it to the addons folder. I have a very vague recollection that this bundle was indeed removed from the distro or that I removed the distro jar in order to replace it with the matching transport bundle but in the addons folder.

Need to check

I’ve checked it again and it working like a charm now. I did mistake. Sorry for wasting your time. I didin’t copy io transport for mqtt to addons folder. After copy everything is working now. Is there a chance do add mqtt binding to paper UI?? How can I add item to paper UI ??
thanks

Hey Marcin,

i am also trying to setup a mqtt binding. can you please explain which steps you have done?
Did you already created a item or thing?

Hi.
I try to get mqtt working with OH2.

What I did:

  • put the binding into the addons folder
  • generated mqtt.cfg inside the services folder

What did i miss?
Stefan

Maybe this? MQTT and OH2 - not working - #6 by marcin

@stefan_bauer

To get mqtt working in OH2 you need to do the follwoing steps

  • Copy org.openhab.binding.mqtt-1.8.0-SNAPSHOT.jar from the OH18 addons to the OH2 addons folder
  • Copy org.openhab.io.transport.mqtt_^.jar from the OH18 distribution to the OH2 addons folder (you find it in /server/plugins/ folder)

Add to runtime.cfg your connection to mqtt server e.g.
mqtt:mymqtt.url=tcp://localhost:1883

Copy your OH1 mqtt lines to the OH2 /conf/item folder

Ok, thanks.

I missed the io.transport…
Now it is working.

:slight_smile:

For me this does not work any more with the 2.0b1 release (was ok before karaf implementation).
In the IDE the MQTT works fine with the latest repo.
Starting the MQTT bundle in karaf the two bundles will start, but give error (log:tail). And MQTT does not work.
Even the rendering of classic-ui and basic-ui becomes crazy.

I have no experience of MQTT before b1, but I am trying to get it up and running for brultech energy monitor.
As soon as I start oh2b1, I receive in my log;
`2016-01-17 18:04:26.929 [ERROR] [org.apache.felix.configadmin ] - [org.openhab.io.transport.mqtt.MqttService, org.osgi.service.cm.ManagedService, id=288, bundle=182/file:/home/micke/OpenHAB2/addons/org.openhab.io.transport.mqtt_1.8.0.jar]: Unexpected problem updating configuration org.openhab.mqtt
java.lang.NoClassDefFoundError: javax/net/ssl/TrustManager
at org.openhab.io.transport.mqtt.MqttService.updated(MqttService.java:80)
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1444)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1400)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:143)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:110)[7:org.apache.felix.configadmin:1.8.8]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
Caused by: java.lang.ClassNotFoundException: javax.net.ssl.TrustManager cannot be found by org.openhab.io.transport.mqtt_1.8.0
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:432)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:345)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:337)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_66]
… 9 more
2016-01-17 18:04:26.987 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app


Is this because of some missing dependency, or is this the error that you are experiencing @sisim ?
`

Starting with a completely fresh installation (package=standard)
copied the two “mqtt” files into the addon folder and adding the broker to the config

i get the following log-errors

2016-01-17 19:16:54.384 [ERROR] [org.eclipse.smarthome.core.transform] - [org.eclipse.smarthome.action.transformation.action(75)] Circular reference detected, getService returning null


2016-01-17 19:16:56.909 [ERROR] [org.apache.felix.configadmin ] - [org.openhab.io.transport.mqtt.MqttService, org.osgi.service.cm.ManagedService, id=261, bundle=158/file:/C:/openHAB2-lochau/addons/org.openhab.io.transport.mqtt-1.9.0-SNAPSHOT.jar]: Unexpected problem updating configuration org.openhab.mqtt
java.lang.NoClassDefFoundError: javax/net/SocketFactory
at org.openhab.io.transport.mqtt.MqttService.updated(MqttService.java:77)
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1444)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1400)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:143)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:110)[7:org.apache.felix.configadmin:1.8.8]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]
Caused by: java.lang.ClassNotFoundException: javax.net.SocketFactory cannot be found by org.openhab.io.transport.mqtt_1.9.0.201601161441
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:432)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:345)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:337)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_65]
… 9 more


Hmm, after some digging into different osgi issues related to javax.net.ssl.* in eclipse mentioning something about the boot delegation.

So I just discovered the following commit:

It seems to fix the issue… more testing to be done. Maybe Kai has some more input on this.

//Jan

Compiled the latest repo (this morning…boot delegation…) and i can confirm the MQTT is running.

open issues for me:

  1. logout from karaf throws enocean exeption
  2. Since b1 the sonos control (classic-ui, basic-ui) is not updated, if you play/pause from the sonos IDE. Play/Pause from the UI are ok. (I hope it is not because of the latest sonos update.Mybe something has changed)
  1. logout from karaf throws enocean exeption

Could you please enter an issue with the exception at Issues · openhab/openhab1-addons · GitHub?

  1. Since b1 the sonos control (classic-ui, basic-ui) is not updated, if you play/pause from the sonos IDE. Play/Pause from the UI are ok. (I hope it is not because of the latest sonos update.Mybe something has changed)

Could you please enter an issue at Issues · eclipse-archived/smarthome · GitHub?

Thanks!

You can check your java configuration in your path. I had the same problem before.

@feversky
What should have changed in the java configuration from euinox to karaf ? what can i check in my path?

@sisim
I had the same error “java.lang.NoClassDefFoundError: javax/net/SocketFactory” before. And then I checked my %path% (win7), the java was configured to a wrong path, this error was gone after fixing it. It seems you have some other issues now. :relaxed: