Zwave SNAPSHOT serial library woes

Greetings,

today I’m performing some tests on the latest zwave binding code by compiling it directly from git, but it seems I’m unable to use it from inside both an OpenHAB2-2.0.0 and a OpenHAB2-2.1.0-SNAPSHOT runtime.
Every time I try to configure the controller this is what I get in the logs:

2017-04-03 18:35:23.143 [DEBUG] [org.openhab.binding.zwave           ] - BundleEvent STARTED - org.openhab.binding.zwave
2017-04-03 18:35:23.148 [DEBUG] [org.openhab.binding.zwave           ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.events.EventFactory}={component.name=org.openhab.binding.zwave.event.BindingEventFactory, component.id=172, service.id=297, service.bundleid=185, service.scope=bundle} - org.openhab.binding.zwave
2017-04-03 18:35:23.153 [DEBUG] [org.openhab.binding.zwave           ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.core.ConfigOptionProvider, org.eclipse.smarthome.config.core.ConfigDescriptionProvider}={component.name=org.openhab.binding.zwave.ConfigDescription, component.id=173, service.id=298, service.bundleid=185, service.scope=bundle} - org.openhab.binding.zwave
2017-04-03 18:35:23.156 [DEBUG] [org.openhab.binding.zwave           ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={component.name=org.openhab.binding.zwave.internal.ZWaveHandlerFactory, component.id=176, service.id=299, service.bundleid=185, service.scope=bundle} - org.openhab.binding.zwave
2017-04-03 18:35:23.459 [DEBUG] [ing.zwave.handler.ZWaveSerialHandler] - Initializing ZWave serial controller.
2017-04-03 18:35:23.462 [DEBUG] [zwave.handler.ZWaveControllerHandler] - Initializing ZWave Controller.
2017-04-03 18:35:23.463 [INFO ] [ing.zwave.handler.ZWaveSerialHandler] - Connecting to serial port '/dev/ttyACM0'
2017-04-03 18:35:23.463 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occured while initializing handler of thing 'zwave:serial_zstick:e47a3545': java.lang.NoSuchMethodError: gnu.io.CommPortIdentifier.open(Ljava/lang/String;I)Lgnu/io/CommPort;
java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: gnu.io.CommPortIdentifier.open(Ljava/lang/String;I)Lgnu/io/CommPort;
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)[:1.8.0_121]
        at java.util.concurrent.FutureTask.get(FutureTask.java:206)[:1.8.0_121]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:194)[99:org.eclipse.smarthome.core:0.9.0.201703201701]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)[99:org.eclipse.smarthome.core:0.9.0.201703201701]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)[99:org.eclipse.smarthome.core:0.9.0.201703201701]
        at org.eclipse.smarthome.core.thing.internal.ThingManager$9.run(ThingManager.java:705)[106:org.eclipse.smarthome.core.thing:0.9.0.201703201701]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_121]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_121]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
Caused by: java.lang.NoSuchMethodError: gnu.io.CommPortIdentifier.open(Ljava/lang/String;I)Lgnu/io/CommPort;
        at org.openhab.binding.zwave.handler.ZWaveSerialHandler.initialize(ZWaveSerialHandler.java:82)
        at org.eclipse.smarthome.core.thing.internal.ThingManager$9$1.call(ThingManager.java:708)
        at org.eclipse.smarthome.core.thing.internal.ThingManager$9$1.call(ThingManager.java:1)
        at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
        ... 3 more

It seems like there’s a misalignment between the serial library used by the binding and the one available from the runtime, which is nrjavaserial (org.openhab/nrjavaserial/3.12.0.OH in both cases), installed either via the addons interface or the karaf feature openhab-transport-serial.
I previously tested the stable version of the binding (2.0.0) and it worked flawlessly with the aforementioned serial library…
Does anybody have a clue about what is going wrong here?

@chris: have you got any pointers for this?

Hi Alan,
maybe it has something to do with:

br,
Raymond

No - as far as I’m aware, nothing has changed recently. As pointed out, maybe it’s go to do with the build errors - I’m not sure though.

Thanks for the feedback. @RayBe @chris.
I’m trying to understand how this error can be happening.
Judging by the stacktrace message, it seems like there’s no CommPort open (String, int) method in the nrjavaserial library used by my OpenHAB2 runtime, which reports 3.12.0.OH as version number. Assuming that this library is built from the one forked by the OpenHab project from the original repository, I can see that the signature is slightly different:


I tried to change the zwave binding code to a RXTXPort reference instead of a CommPort one to no avail, as the code is no longer compilable after that (Type mismatch: cannot convert from CommPort to RXTXPort). BTW, the hierarchy appears to be like this: RXTXPort extends SerialPort extends CommPort.
It seems like at compile time the right nrjavaserial library is picked up and I get no complains in compiling the vanilla binding code, while at runtime a different one gets installed and then the mismatch happens.
Will try to look further into it…

Well, this is odd… I tried compiling another time (with maven) after changing the return type and this time the build process went smooth and I’m currently testing this custom version inside the openhab runtime without the previous issue.