MQTT and OH2 - not working

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

@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 https://github.com/openhab/openhab/issues?

  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 https://github.com/eclipse/smarthome/issues?

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:

Now I tried this with a OH2 snapshot from this week. I tried installing via Paper UI, manually downloading mqtt transport/binding 1.9 snapshots and also with the 1.8.1 addons. At best with 1.9 I get this in the log:

2016-03-13 21:54:09.039 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2016-03-13 21:54:09.039 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘local’

mqtt.cfg:
local.url=tcp://localhost:1883

runtime.cfg
mqtt:local.url=tcp://localhost:1883

items.cfg
String mqtt_pir “Pi PIR [%s]” (Mags) { mqtt="<[local:/sensors/motion:state:default]" }

I’ve never run mqtt in OH before, but I see “ON|OFF” with this:
$ mosquitto_sub -h localhost -t sensors/motion
…so I guess mqtt works

Any ideas? :slight_smile:

i’m a newbe to Openhab where do I find the io.transport binding?(sorry i missed where Stefan said it was in the server plugins folder)

That was still based on the old way. In the new karaf builds it is different.
to get the io transport, type the following in the OH command line
feature:install openhab-transport-mqtt

1 Like

Should i be able to see to see the Binding in the paper ui openhab2 is connecting to MQTT but I am unable to see it in openhab