Tomcat : Using RXTX with Tomcat applications on linux
This page last changed on May 30, 2013 by admin.
Install the proper linux package
apt-get install librxtx-java
Put the library on Tomcat's classpath
Houston we have a problem?
On booting the app RXTX reports the following:
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
- download the corresponding binaries from http://rxtx.qbang.org/wiki/index.php/Download
- place the RXTXComm.jar in
- make sure no rxtx jars are included in the war file
- restart tomcat
The download site states:
TODO: The 2.2pre2 bins contain the 2.2pre1 jar file and the 2.2pre2 native lib which causes a mismatch warning
So not a problem after all? At least they are at the same minor version now.
Next issue: no ports found
-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0 as a startup parameter as suggested by this article did not make a difference.
The article also mentions:
To run the Java application later without root, we need a new user which has the privilege to access serial ports. To do so, just add a new user to group dialout
So in my case:
sudo adduser tomcat dialout