Adding to this discussion: the listener.start() calls into RtuSlave.start(), which immediately calls SerialSlave.start():
in SerialSlave:
@Override public void start() throws ModbusInitException { try { serialPort = SerialUtils.openSerialPort(serialParameters); transport = new StreamTransport(serialPort.getInputStream(), serialPort.getOutputStream()); transport.start("Modbus4J SerialSlave"); // <--- This line throws the exception } catch (Exception e) { throw new ModbusInitException(e); } }The line that throws the NullPointerException is the third line, the transport.start("Modbus4J SerialSlave").
This calls into the StreamTransport class of seroUtils.jar, which we do not have the source code for.
Would it be possible for me to get this source code so that I can debug this problem?