getting java.lang.UnsatisfiedLinkError when running as modbusmaster
-
Hello,
I am experiencing problems running the following code:
ModbusFactory factory = new ModbusFactory(); SerialParameters params = new SerialParameters(); params.setCommPortId("/dev/ttyM0"); params.setBaudRate(9600); params.setDataBits(8); params.setParity(0); params.setStopBits(1); RtuMaster master = (RtuMaster) factory.createRtuMaster(params); try { master.setTimeout(1000); master.init(); List<Integer> slaves = master.scanForSlaveNodes(); System.out.println("slaves: "+slaves); } catch (ModbusInitException ex) { Logger.getLogger(modbus.class.getName()).log(Level.SEVERE, null, ex); }
when I run the above code, I get the following error:
java -cp lib/ -jar HaystackClient.jar
log4j:WARN No appenders could be found for logger (com.serotonin.io.serial.JsscSerialPortProxy).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /root/.jssc/linux/libjSSC-2.8_armsf.so: /root/.jssc/linux/libjSSC-2.8_armsf.so: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at jssc.SerialNativeInterface.<clinit>(SerialNativeInterface.java:172)
at jssc.SerialPort.<init>(SerialPort.java:120)
at com.serotonin.io.serial.JsscSerialPortProxy.openImpl(JsscSerialPortProxy.java:111)
at com.serotonin.io.serial.SerialPortProxy.open(SerialPortProxy.java:80)
at com.serotonin.io.serial.SerialUtils.openSerialPort(SerialUtils.java:95)
at com.serotonin.modbus4j.serial.SerialMaster.init(SerialMaster.java:58)
at com.serotonin.modbus4j.serial.rtu.RtuMaster.init(RtuMaster.java:45)
at modbus.main(modbus.java:39)Two strange things:
1: The file in the error message actually exists
2: The processor is an ARMv7 Cortex-A8 which has hard float, so it doesn't make sense to load armsf lib.Any ideas would be greatly appreciated :-)
-
you run on a linux system. please confirm the serial com name is "/dev/ttyM0"? right?
and this should be a jssc environment problem,pleause comfirm if you lose some jar lib