tobof / openhab-addons

The next-generation open Home Automation Bus (openHAB)
Eclipse Public License 2.0
39 stars 30 forks source link

[MYSENSORS] ERROR - Gateway thing not initialized #123

Closed vzorglub closed 5 years ago

vzorglub commented 5 years ago

Current Behavior

After defining the thing as per the installation guide

Bridge mysensors:bridge-mqtt:gateway [ brokerName="mosquitto", topicPublish="OHin", topicSubscribe="OHout", startupCheckEnabled=true ] {
}

Error in OH log:

2018-09-14 11:23:44.524 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@741b3b8': org/eclipse/smarthome/io/transport/mqtt/MqttPublishCallback
java.lang.NoClassDefFoundError: org/eclipse/smarthome/io/transport/mqtt/MqttPublishCallback
    at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:?]
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass(ModuleClassLoader.java:276) ~[?:?]
    at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.defineClass(ClasspathManager.java:655) ~[?:?]
    at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl(ClasspathManager.java:578) ~[?:?]
    at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:538) ~[?:?]
    at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:525) ~[?:?]
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:328) ~[?:?]
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:368) ~[?:?]
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:446) ~[?:?]
    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) ~[?:?]
    at org.openhab.binding.mysensors.internal.protocol.mqtt.MySensorsMqttConnection.<init>(MySensorsMqttConnection.java:46) ~[?:?]
    at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.setup(MySensorsGateway.java:98) ~[?:?]
    at org.openhab.binding.mysensors.handler.MySensorsBridgeHandler.initialize(MySensorsBridgeHandler.java:81) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
    at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [94:org.eclipse.smarthome.core:0.10.0.201809111909]
    at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [94:org.eclipse.smarthome.core:0.10.0.201809111909]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
    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: org.eclipse.smarthome.io.transport.mqtt.MqttPublishCallback cannot be found by org.openhab.binding.mysensors_2.3.0.201803141156
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433) ~[?:?]
    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) ~[?:?]
    ... 27 more

Possible Solution

Your Environment

New install Ubuntu Server 18.04 Openhab latest snapshot 1361 Java:

openjdk version "1.8.0_163"
OpenJDK Runtime Environment (Zulu 8.28.0.1-linux64) (build 1.8.0_163-b01)
OpenJDK 64-Bit Server VM (Zulu 8.28.0.1-linux64) (build 25.163-b01, mixed mode)
tobof commented 5 years ago

Is the ESH MQTT installed? Please verify with: bundle:list in the karaf console.

If it is missing install it with: feature:install esh-io-transport-mqtt

arjveld commented 5 years ago

Hi,

I'm getting exactly the same error. Already asked in the opehab forum if there was something known about it. esh-io-transport-mqtt is installed. Got a perfect running mosquitto-server as well as a runnig mysensors-mqtt gateway. In the config directory there is a file called org.eclipse.smarthome.mqtt.cfg also running the latest openhab 2.4, but it also happend on a 10 day earlier version.

vzorglub commented 5 years ago

Yes it is installed

265 │ Active   │  80 │ 0.10.0.201809111909    │ Eclipse SmartHome MQTT Transport Bundle
266 │ Active   │  80 │ 2.3.0.201803141156     │ MySensors Binding
tobof commented 5 years ago

@vzorglub & @arjveld : Please try out this version: Download

Due to API changes the MQTT implementation needed some changes: https://github.com/eclipse/smarthome/pull/5535

vzorglub commented 5 years ago

I get this as soon as I copy the jar file in the addons directory:


2018-09-28 15:26:10.519 [WARN ] [org.apache.felix.fileinstall        ]
- Error while starting bundle:
file:/usr/share/openhab2/addons/org.openhab.binding.mysensors-2.4.0-mqtt-api-change.jar

org.osgi.framework.BundleException: Could not resolve module:
org.openhab.binding.mysensors [261]

  Unresolved requirement: Import-Package: gnu.io

    at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]

    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383)
~[?:?]

    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260)
[10:org.apache.felix.fileinstall:3.6.4]

    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233)
[10:org.apache.felix.fileinstall:3.6.4]

    at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520)
[10:org.apache.felix.fileinstall:3.6.4]

    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
[10:org.apache.felix.fileinstall:3.6.4]

    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
[10:org.apache.felix.fileinstall:3.6.4]

On Fri, 28 Sep 2018 at 10:26, Tim notifications@github.com wrote:

@vzorglub https://github.com/vzorglub & @arjveld https://github.com/arjveld : Please try out this version: Download http://oberfoell.com/openhab2/org.openhab.binding.mysensors-2.4.0-mqtt-api-change.jar

Due to API changes the MQTT implementation needed some changes: eclipse/smarthome#5535 https://github.com/eclipse/smarthome/pull/5535

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tobof/openhab2-addons/issues/123#issuecomment-425377896, or mute the thread https://github.com/notifications/unsubscribe-auth/ASmb4I7FYkdkNp0v56pQTnBh8zYIFSswks5ufetDgaJpZM4WpG5N .

tobof commented 5 years ago

Please install the serial feature: feature:install openhab-transport-serial

vzorglub commented 5 years ago

Now i get:


2018-09-28 20:55:33.075 [WARN ] [org.apache.felix.fileinstall        ]
- Error while starting bundle:
file:/usr/share/openhab2/addons/org.openhab.binding.mysensors-2.4.0-mqtt-api-change.jar

org.osgi.framework.BundleException: Could not resolve module:
org.openhab.binding.mysensors [270]

  Unresolved requirement: Import-Package: org.eclipse.jdt.annotation;
resolution:="optional"

  Unresolved requirement: Import-Package:
org.eclipse.smarthome.io.transport.mqtt

    at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]

    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383)
~[?:?]

    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260)
[10:org.apache.felix.fileinstall:3.6.4]

    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233)
[10:org.apache.felix.fileinstall:3.6.4]

    at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520)
[10:org.apache.felix.fileinstall:3.6.4]

    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
[10:org.apache.felix.fileinstall:3.6.4]

    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
[10:org.apache.felix.fileinstall:3.6.4]

On Fri, 28 Sep 2018 at 17:11, Tim notifications@github.com wrote:

Please install the serial feature: feature:install openhab-transport-serial

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tobof/openhab2-addons/issues/123#issuecomment-425486432, or mute the thread https://github.com/notifications/unsubscribe-auth/ASmb4G5MOX0A5FeMTMp11lNJ5V5ryZ0Hks5ufkoWgaJpZM4WpG5N .

tobof commented 5 years ago

It's working with Build 1377 for me.

Did you check for the MQTT bundle again? feature:install esh-io-transport-mqtt

vzorglub commented 5 years ago

Yes mqtt bundle installed I am on build 1377 And I am getting:

2018-10-01 10:10:55.115 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.mysensors-2.4.0-mqtt-api-change.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mysensors [261]
  Unresolved requirement: Import-Package: gnu.io
    at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[?:?]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [10:org.apache.felix.fileinstall:3.6.4]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [10:org.apache.felix.fileinstall:3.6.4]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [10:org.apache.felix.fileinstall:3.6.4]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [10:org.apache.felix.fileinstall:3.6.4]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [10:org.apache.felix.fileinstall:3.6.4]

As soon as I dump the jar file in the addons directory

What is gnu.io?

tobof commented 5 years ago

Both gnu.io (for serial gateways) and esh-io-transport-mqtt (for MQTT gateways) are needed by the binding.

I've executed: feature:install openhab-transport-serial and feature:install esh-io-transport-mqtt dumped the jar in the addons folder and everything came up just fine.

vzorglub commented 5 years ago

Ok after installing the serial it works I did it before though but it's now online Yeah

vzorglub commented 5 years ago

Hi @tobof tobof, I know you have colsed this but I still have a problem After restarting OH I have to do: feature:install feature:install openhab-transport-serial in order for the binding to come alive Why do I have to do this everytime? Anyway to install this feature permanently?

EDIT I have thought of something. I use manual binding configuration in the addons.cfg If I add the serial binding to the list would that install that feature? And is that why the feature is not retained after a restart? Or what would I need to add the the addons.cfg for it to load on start up?

andreacioni commented 5 years ago

Hi @vzorglub , you have to do that only on a fresh OH installation or in case of an upgrade. The problem you experienced is well known in the OH community (see here, or here) The solution of that problem will come when the MS binding will be integrated inside the openhab2-addons official repository.