RXTX Version mismatch?

Hello i got this Error message after i try to run ./start_debug.sh for my optolink adapter.

How can i solve the “RXTX Version mismatch” Error?

Thank you.

Native lib Version = RXTX-2.2pre2
Java lib Version   = RXTX-2.1-7
WARNING:  RXTX Version mismatch
	Jar version = RXTX-2.1-7
	native lib Version = RXTX-2.2pre2
RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyAMA0: Die Datei e10:25:49.040 [main] ERROR de.myandres.optolink.Main main - Something is wrong not init
gnu.io.NoSuchPortException: null
	at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:218) ~[optolink-jar-with-dependencies.jar:na]
	at de.myandres.optolink.OptolinkInterface.<init>(OptolinkInterface.java:44) ~[optolink-jar-with-dependencies.jar:na]
	at de.myandres.optolink.Main.main(Main.java:39) ~[optolink-jar-with-dependencies.jar:na]
Exception in thread "main" java.lang.NullPointerException
	at de.myandres.optolink.Main.main(Main.java:46)

after i download from http://rxtx.qbang.org/wiki/index.php/Download the same version of the library i got this error now:

java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
Exception in thread “main” java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path

The error indicates an issue with the rxtxSerial path. Have you verified the correct path and permissions?

i copy librxtxSerial-2.2pre1.so back and now i got this error massage

OpenJDK Client VM warning: You have loaded library /usr/lib/jni/librxtxSerial-2.2pre1.so which might have disabled stack guard. The VM will try to fix the stack guard now.

It’s highly recommended that you fix the library with ‘execstack -c <libfile>’, or link it with ‘-z noexecstack’.

java.lang.UnsatisfiedLinkError: /usr/lib/jni/librxtxSerial-2.2pre1.so: /usr/lib/jni/librxtxSerial-2.2pre1.so: falsche ELF-Klasse: ELFCLASS64 (Possible cause: architecture word width mismatch) thrown while loading gnu.io.RXTXCommDriver

Exception in thread “main” java.lang.UnsatisfiedLinkError: /usr/lib/jni/librxtxSerial-2.2pre1.so: /usr/lib/jni/librxtxSerial-2.2pre1.so: falsche ELF-Klasse: ELFCLASS64 (Possible cause: architecture word width mismatch)

What is OH running on and what version of java is installed? Looking above that message usually pops up when using 64-bit JVM on ARM platform. If thats the case you will need to install the 32-bit version of the JVM for ARM platforms.

now i delete the hole pages with apt-get purge librxtx-java and reinstall it again apt-get install librxtx-java.

Now i am the beginning with the same warning:

Native lib Version = RXTX-2.2pre2
Java lib Version = RXTX-2.1-7
WARNING: RXTX Version mismatch
Jar version = RXTX-2.1-7
native lib Version = RXTX-2.2pre2
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyAMA0

I run it on a RPI2 with raspbian.

How can i update the Java lib Verision to the newer one or the Nativ lib Version to the older 2.1-7 Verions to fix the mismatch problem?

From the terminal type java -version and post the output.

Also verify that you have set the EXTRA_JAVA_OPTS in /etc/default/openhab2 to this:

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0"

Will OH be the only thing running on your Pi?

Output:

openjdk version “1.8.0_181”

OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1~deb9u1-b13)

OpenJDK Client VM (build 25.181-b13, mixed mode)

i also check the “EXTRA_JAVA_OPTS=” entry.

Place this in Extra java opts and restart OH.

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0"

i leave it with your parameter and after a restart i got this message:

Native lib Version = RXTX-2.2pre2

Java lib Version = RXTX-2.1-7

WARNING: RXTX Version mismatch

Jar version = RXTX-2.1-7

native lib Version = RXTX-2.2pre2

RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyAMA0: Die Datei e17:08:06.738 [main] ERROR de.myandres.optolink.Main main - Something is wrong not init

gnu.io.NoSuchPortException: null

Take a look here and make sure everything is set up correctly and try installing the recommended Zulu java build. https://www.openhab.org/docs/installation/linux.html#installation

If you only plan to use the Pi for OH then installing via openhabian image would be an easier route.

I install Zulu but i got the same error message.

My Java version now

openjdk version “1.8.0_152”

OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76)

OpenJDK Client VM (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 25.152-b76, mixed mode, Evaluation)

i think the problem is the different Version from the Jar version and the native lib Version. How can i get the same version?

Add or replace with this in extra java opts. Seems there was a bug fix and this worked, just not sure when. Its worth a try
-Dgnu.io.rxtx.NoVersionOutput=true

I also noticed this on the link you provided…Unless you have any specific reasons, this is the recommended download. If you need to be compatible with javax.comm.* then download RXTX 2.0. Not sure what javax.comm is, maybe it means generic?

Have you tried the openhabian tools? sudo openhabian-config

i try your tip but without any effect.

i didn’t use openhabian so i can’t use this config setting.

Have you added openhab user to the lock group and verified from terminal with: id openhab

If not then add openhab user to the lock group: usermod -a -G lock openhab

Change permissions: chown root:lock /run/lock
Add group write: chmod a+w lock

See if this works but keep in mind that a restart will recreate the run/lock. If this does work let me know and we can make a config change to keep these settings permanently.

if i try id openhab i got

uid=111(openhab) gid=114(openhab) Gruppen=114(openhab)

if i try to reinstall RXTX which version can i use for my rpi2? the linux verion?

Now were getting somewhere.

Add the openhab user to the lock group and see my edit on last post for the other steps

how can i add openhab to the lock group?