Serial library (NRJavaSerial) causes JVM to crash on ARM device (Debian Linux)

1,023 views
Skip to first unread message

daka

unread,
Mar 16, 2013, 3:14:36 PM3/16/13
to ope...@googlegroups.com
I had version 1.1 of OpenHAB working on my SheevaPlug. This is an ARMv5 device with Debian installed (32 bits). No problems with the serial port.
But version 1.2 with the NRJavaSerial library causes the JVM to crash.

19:58:45.267 INFO  o.o.c.internal.CoreActivator[:92] - openHAB runtime has been started (v1.2.0).
19:58:53.338 DEBUG o.o.m.i.i.ItemModelActivator[:44] - Registered 'item' configuration parser
19:58:53.467 DEBUG o.o.c.a.i.AutoUpdateActivator[:51] - AutoUpdate binding has been started.
19:58:55.263 DEBUG o.o.b.s.i.SerialActivator[:51] - Serial binding has been started.
19:58:55.411 DEBUG o.o.c.i.items.ItemRegistryImpl[:151] - Item provider 'GenericItemProvider' has been added.
19:58:57.469 DEBUG o.o.m.p.i.PersistenceModelActivator[:43] - Registered 'persistence' configuration parser
19:58:58.215 DEBUG o.o.c.t.i.TransformationActivator[:58] - Transformation Service has been started.
19:58:58.997 DEBUG o.o.i.g.internal.GCalActivator[:54] - Google Calendar IO has been started.
19:58:59.408 DEBUG o.o.i.g.i.p.GCalPresenceSimulation[:161] - Scheduled Google Calendar Upload-Job with interval '10'
19:59:00.520 DEBUG o.o.i.m.i.MultimediaActivator[:54] - Multimedia I/O bundle has been started.
19:59:02.862 DEBUG o.o.c.s.AbstractActiveService[:196] - HTTP Refresh Service has been started
19:59:02.874 DEBUG o.o.c.s.AbstractActiveService[:196] - NTP Refresh Service has been started
19:59:02.897 DEBUG o.o.b.h.internal.HttpInBinding[:125] - item 'Weather_Temperature' is about to be refreshed now
19:59:03.093 DEBUG o.o.b.ntp.internal.NtpBinding[:113] - Got time from 0.europe.pool.ntp.org: Saturday, March 16, 2013 7:59:03 PM CET
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyS0
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x4feccb94, pid=18101, tid=1339896944
#
# JRE version: 7.0_10-b18
# Java VM: Java HotSpot(TM) Embedded Client VM (23.6-b04 mixed mode linux-arm )
# Problematic frame:
# C  [libNRJavaSerialv6_HF.so+0x8b94]  Java_gnu_io_RXTXCommDriver_testRead+0x1c0
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /opt/openhab1.2/hs_err_pid18101.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Information from hs_err_pid18101.log
===========================
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  gnu.io.RXTXCommDriver.testRead(Ljava/lang/String;I)Z+0
j  gnu.io.RXTXCommDriver.registerValidPorts([Ljava/lang/String;[Ljava/lang/String;I)V+202
j  gnu.io.RXTXCommDriver.registerScannedPorts(I)V+1502
j  gnu.io.RXTXCommDriver.initialize()V+35
j  gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava/util/Enumeration;+53
j  gnu.io.NativeResource.testNativeCode()V+0
j  gnu.io.NativeResource.inJarLoad(Ljava/lang/String;)V+37
j  gnu.io.NativeResource.loadLib(Ljava/lang/String;)V+37
j  gnu.io.NativeResource.load(Ljava/lang/String;)V+138
j  gnu.io.SerialManager.<init>()V+23
j  gnu.io.SerialManager.getInstance()Lgnu/io/SerialManager;+10
j  gnu.io.RXTXCommDriver.<clinit>()V+39
v  ~StubRoutines::call_stub
J  java.lang.Class.forName0(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;
j  java.lang.Class.forName(Ljava/lang/String;)Ljava/lang/Class;+5
j  gnu.io.CommPortIdentifier.<clinit>()V+12
v  ~StubRoutines::call_stub
j  org.openhab.binding.serial.internal.SerialDevice.initialize()V+0
j  org.openhab.binding.serial.internal.SerialBinding.processBindingConfiguration(Ljava/lang/String;Lorg/openhab/core/items/Item;Ljava/lang/String;)V+46
j  org.openhab.model.item.internal.GenericItemProvider.dispatchBindings(Ljava/lang/String;Lorg/openhab/core/items/Item;Lorg/eclipse/emf/common/util/EList;)V+78
j  org.openhab.model.item.internal.GenericItemProvider.getItems()Ljava/util/Collection;+372
j  org.openhab.core.internal.items.ItemRegistryImpl.allItemsChanged(Lorg/openhab/core/items/ItemProvider;Ljava/util/Collection;)V+119
j  org.openhab.model.item.internal.GenericItemProvider.modelChanged(Ljava/lang/String;Lorg/openhab/model/core/EventType;)V+37
j  org.openhab.model.core.internal.ModelRepositoryImpl.notifyListeners(Ljava/lang/String;Lorg/openhab/model/core/EventType;)V+35
j  org.openhab.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(Ljava/lang/String;Ljava/io/InputStream;)Z+72
j  org.openhab.model.core.internal.folder.FolderObserver.checkFolder(Ljava/lang/String;)V+212
j  org.openhab.model.core.internal.folder.FolderObserver.run()V+105

Anybody else experienced this behaviour? Maybe on a Rasberry Pi?

Regards,
David

davy vanherbergen

unread,
Mar 18, 2013, 12:27:35 PM3/18/13
to ope...@googlegroups.com
Hi David

I have no issues with nrjavaserial and Oracle Java 8 on a raspberry pi.  
You might have a conflict on your system between the old (RXTX) and the new libraries (nrjavaserial). Did you completely uninstall everything from RXTX before starting openhab?
You could try apt-get remove librxtx-java and check that there is no librxtxSerial.so or RXTXcomm.jar in your path.

Kind regards,

Davy Vanherbergen 

daka

unread,
Mar 19, 2013, 6:31:44 PM3/19/13
to ope...@googlegroups.com
Hi Davy,

Thanks for your reply. I checked for old versions of RXTX in the path. But that doesn't seem to be the case. I tried with a single class based on the demo (NRSerialDemo) on the wiki of nrjavaserial. Also crashes with the same error. Just keep digging, I guess.

Regards,
David

Op maandag 18 maart 2013 17:27:35 UTC+1 schreef davy vanherbergen het volgende:

daka

unread,
Mar 20, 2013, 8:18:25 AM3/20/13
to ope...@googlegroups.com
I logged an issue (#30) with NRJavaSerial project. Maybe they can help.

David

Op dinsdag 19 maart 2013 23:31:44 UTC+1 schreef daka het volgende:

daka

unread,
Mar 23, 2013, 12:33:22 PM3/23/13
to ope...@googlegroups.com
NRJavaSerial doesn't support ARMv5 yet, but this issue can be solved by adding a JVM argument.
java -DlibNRJavaSerial.userlib=<path to my .so> -jar Myjar.jar
In my case libNRJavaSerial_legacy.so worked. This file can be extracted from the nrjavaserial-3.8.8.jar.
It looks like the guys from NRJavaSerial are changing their code to solve this issue (I saw some changes in their repository).

Cheers,
David

Op woensdag 20 maart 2013 13:18:25 UTC+1 schreef daka het volgende:
Message has been deleted

zahran...@gmail.com

unread,
Nov 7, 2013, 3:43:40 AM11/7/13
to ope...@googlegroups.com
I'm trying to get NRJavaSerial to work on Debian, and so far it failed.
It initially throw a NullPointerException which came from loadlib, and when I tried linking the library with DLink as suggested it threw UnsatisfiedLinkError and that it can't open the shared object: No Such file or directory .. although the *.so file was there in the given path.

the processor is ARMv6.

any advice? 

David

unread,
Nov 7, 2013, 4:48:32 AM11/7/13
to ope...@googlegroups.com, zahran...@gmail.com
For AMRv6 you don't need to add the -DlibNRJavaSerial.userlib param.
That is only for ARMv5.
I think you need to add another parameter for the serial symlink. Please check: https://code.google.com/p/openhab-samples/wiki/Tricks#How_to_configure_openHAB_to_connect_to_device_symlinks_(on_Linux
What serial port are you using?

-David

Op donderdag 7 november 2013 09:43:40 UTC+1 schreef zahran...@gmail.com:

zahran...@gmail.com

unread,
Nov 7, 2013, 5:07:17 AM11/7/13
to ope...@googlegroups.com, zahran...@gmail.com
The serial port is /dev/ttyUSB0 
The output I got without using the -DlibNRJavaSerial.userlib param is as follows:
Exception in thread "Thread-18" java.lang.ExceptionInInitializerError
        at pm.services.NRSerialPort.getAvailableSerialPorts(NRSerialPort.java:141)
        at pm.services.ScaleListener.<init>(ScaleListener.java:72)
        at pm.services.WaterSupplyManager.run(WaterSupplyManager.java:62)
        at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.NullPointerException
        at gnu.io.NativeResource.copyResource(NativeResource.java:145)
        at gnu.io.NativeResource.inJarLoad(NativeResource.java:36)
        at gnu.io.NativeResource.loadLib(NativeResource.java:52)
        at gnu.io.NativeResource.load(NativeResource.java:28)
        at gnu.io.SerialManager.<init>(SerialManager.java:10)
        at gnu.io.SerialManager.getInstance(SerialManager.java:16)
        at gnu.io.RXTXCommDriver.<clinit>(RXTXCommDriver.java:87)
        ... 4 more

CPU INFO:

Processor       : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 0002
Serial          : 00000000f4e9b06f

uname -a:
Linux raspberrypi 3.6.11+ #557 PREEMPT Wed Oct 2 18:49:09 BST 2013 armv6l GNU/Linux

David

unread,
Nov 7, 2013, 6:07:28 AM11/7/13
to ope...@googlegroups.com, zahran...@gmail.com
Many people are using NRJavaSerial on Raspberry Pi. As far as I can see, there are no issues with the serial comm.
I don't have a RPi so I don't know if there are any special instructions to get this running. Maybe some RPi owner with openHAB running can comment on this issue.

-David


Op donderdag 7 november 2013 11:07:17 UTC+1 schreef zahran...@gmail.com:

zahran...@gmail.com

unread,
Nov 7, 2013, 11:39:33 AM11/7/13
to ope...@googlegroups.com, zahran...@gmail.com
The thing is when I used the original rxtx library I did not face such exception, it worked just fine. I only decided to try the NRJavaSerial after I faced occasionally an exception error in nativeavailable.

So I'm not quite sure if the NRJavaSerial needs some prerequisite that was not required by the rxtx!

zahran...@gmail.com

unread,
Nov 7, 2013, 12:14:53 PM11/7/13
to ope...@googlegroups.com, zahran...@gmail.com
I got it to working by using "nrjavaserial-3.8.8.jar" instead of "nrjavaserial-3.9.1", so it might be a bug in the latest version of the library ""nrjavaserial-3.9.1".
Reply all
Reply to author
Forward
0 new messages