I have been trying to implement a RTU slave application, I used the ListenerTest as a start with the necessary modifications to make it create a RTU slave instead of the TCP slave. However when I try to run it I get a NullPointerException at the SteamTransporter.
run: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 com.serotonin.modbus4j.exception.ModbusInitException: java.lang.NullPointerException at com.serotonin.modbus4j.serial.SerialSlave.start(SerialSlave.java:51) at com.serotonin.modbus4j.serial.rtu.RtuSlave.start(RtuSlave.java:40) at kiwi.main$1.run(main.java:46) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.NullPointerException at com.serotonin.messaging.StreamTransport.start(StreamTransport.java:32) at com.serotonin.modbus4j.serial.SerialSlave.start(SerialSlave.java:48) ... 3 more
I looked through the examples but couldn't find any that were very relevant except the listener one. Google didn't really turn up anything useful either. When I looked closer at the code I figured it might be something up with the name being passed to StreamTransport and fetched the thread and got it's name and passed that as a variable instead. That didn't make any difference though.
Thanks in advance, hope I didn't miss anything painfully obvious :)