openHAB1.8.3 on pi3: CUL not accessible

Hi,
after migrating from pi2 onto pi3 the Intertechno bindung does not work any more. After checking protection of /dev/ttyACM1, the startup parameter -Dgnu.io.rxtx.SerialPorts=… and membership to group dialout, tried to run it as root in vain, I enabled the java class loader verbosity…

Beside the error messages with openhab.log…
20:40:01.400 [ERROR] [.o.b.i.i.CULIntertechnoBinding:105 ] - Can’t open CUL
org.openhab.io.transport.cul.CULDeviceException: gnu.io.NoSuchPortException
at org.openhab.io.transport.cul.internal.CULSerialHandlerImpl.openHardware(CULSerialHandlerImpl.java:269) ~[na:na]
at org.openhab.io.transport.cul.internal.AbstractCULHandler.open(AbstractCULHandler.java:154) ~[na:na]
at org.openhab.io.transport.cul.CULManager.createNewHandler(CULManager.java:170) ~[bundlefile:na]
at org.openhab.io.transport.cul.CULManager.getOpenCULHandler(CULManager.java:89) ~[bundlefile:na]
at org.openhab.io.transport.cul.CULManager.getOpenCULHandler(CULManager.java:54) ~[bundlefile:na]
at org.openhab.binding.intertechno.internal.CULIntertechnoBinding.bindCULHandler(CULIntertechnoBinding.java:101) [bundlefile:na]
at org.openhab.binding.intertechno.internal.CULIntertechnoBinding.setNewDeviceName(CULIntertechnoBinding.java:94) [bundlefile:na]
at org.openhab.binding.intertechno.internal.CULIntertechnoBinding.updated(CULIntertechnoBinding.java:208) [bundlefile:na]
at org.eclipse.equinox.internal.cm.ManagedServiceTracker$1.run(ManagedServiceTracker.java:183) [org.eclipse.equinox.cm_1.0.400.v20120522-1841.jar:na]
at org.eclipse.equinox.internal.cm.SerializedTaskQueue$1.run(SerializedTaskQueue.java:36) [org.eclipse.equinox.cm_1.0.400.v20120522-1841.jar:na]
Caused by: gnu.io.NoSuchPortException: null
at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:273) ~[na:na]
at org.openhab.io.transport.cul.internal.CULSerialHandlerImpl.openHardware(CULSerialHandlerImpl.java:244) ~[na:na]
… 9 common frames omitted
20:40:01.442 [INFO ] [.service.AbstractActiveService:169 ] - CULIntertechno Refresh Service has been started

there is now the additional message probably leading to the cause of the error:

java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver
java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver

It seems to be originated in a missing native library. Any ideas?

I’m using the CUL also, however on a rpi2 and with OH2.
So I can’t verify my statement.

Your error looks the same as one rperorted early in this thread testing-help-needed-for-cul-refactoring.
Back then an addon called “org.openhab.io.transport.serial_3.12.0.a1.jar” was needed.
Didn’t you use in your previous setup?

Thanks, Jürgen, for this pointer. Yes, I do use the same setup as on the pi2

In fact, adding the “org.openhab.io.transport.serial” did not lead to success,
but pointed my into the correct direction.

With help of the enabled java-class-loading option I came to the conclusion
that there might be an issue with the nrjavaserial-3.9.3.jar which does not
contain any pi3 specifics.

By using that library with a small test programm (http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port)
without success in opposite to using the rxtx library:

Raspberry3$ java -Djava.library.path=/usr/lib/jni -cp /usr/share/java/RXTXcomm.jar:. TwoWaySerialComm
V
V 1.66 CUL868

Raspberry3$ java -Djava.library.path=/usr/lib/jni -cp /var/lib/openhab/workspace/org.eclipse.osgi/bundles/202/1/.cp/lib/nrjavaserial-3.9.3.jar:/usr/share/java/RXTXcomm.jar:. TwoWaySerialComm
java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver
java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver
gnu.io.NoSuchPortException
at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:273)
at TwoWaySerialComm.connect(TwoWaySerialComm.java:9)
at TwoWaySerialComm.main(TwoWaySerialComm.java:78)

Unfortunatelly ;-( I have not yet found a smooth way to use this other serial io library for OpenHAB.

The posted Jar was not an official addon, it was more a bug fix which enabled the CUL See the non-standard ending “.a1. jar”. I can’t say anything about the differences if running on rpi3

Have you tried using your CUL just with screen commands?
That way I made sure that it was working at all.

Yes, the CUL works fine. With screen and even with the mentioned small java program
based on the RXTXcomm library the serial interfaces can be accessed without problems…

The problem was the not-loaded native part of the libNRJavaSerial.

After adding the following line to /etc/default/openhab

JAVA_ARGS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM1 -Djna.boot.library.path=/usr/lib/jni -DlibNRJavaSerial.userlib=/usr/lib/jni/libNRJavaSerial.so"

together with putting the appropriate native libraries (libNRJavaSerial_HF.so libNRJavaSerial.so libNRJavaSerialv5.so libNRJavaSerialv6_HF.so libNRJavaSerialv6.so) into the directory /usr/lib/jni everything works fine, again.

Hello @gs4711, great you got it working for you.

This sounds pretty specific and probably worth incorporating and/or documenting.
What do you think would be the right solution to tackle that problem for others?
Short term solution would be to include your solution in the bindings wiki article.
In long term, this should be dealt with in openHAB2 IF the problem is there as well.

Would you up to the task to modifying the wiki article?

I’m curious on a special point, under what user do you start openhab?
I’m using OH2 and can get the CUL to work only if I start as root.

With the above mentioned method it is possible to run it as user openhab (being included in the group dialout).

Did put that into /etc/default/openhab2
However, it didn’t work either.
@Udo_Hartmann had suggested to use the same entry named “EXTRA_JAVA_OPTS” in Here.. Resulting in the same “Can’t open CUL” error.

Is there any error message when you start the openhab manually (i.e. /usr/share/openhab/bin/openhab.sh)? In my original case there have been the “java.lang.UnsatisfiedLinkError gnu.io.RXTXCommDriver.nativeGetVersion” message…

I don’ t have a directory openhab in usr/share. That is probably due to the manual installation instead of apt -get.

I see - btw as you mentioned OH2: do you have the same problems when accessing the CUL?

When running OH2 as user root, everything is working (i.e. the CUL is sending the messages). When using the user openhab I get the above mentioned erors and the CUL is obviously not sending.