<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[StreamTransport null pointer exception]]></title><description><![CDATA[<p dir="auto">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.</p>
<pre><code>
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

</code></pre>
<p dir="auto">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.</p>
<p dir="auto">Thanks in advance, hope I didn't miss anything painfully obvious :)</p>
]]></description><link>https://forum.mango-os.com/topic/735/streamtransport-null-pointer-exception</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 02:09:55 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/735.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 01 Feb 2011 14:25:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to StreamTransport null pointer exception on Tue, 22 Apr 2014 23:41:03 GMT]]></title><description><![CDATA[<p dir="auto">The line is not in the CVS code. Perhaps it still is in the src jar file. Try using the repo source instead.</p>
]]></description><link>https://forum.mango-os.com/post/8504</link><guid isPermaLink="true">https://forum.mango-os.com/post/8504</guid><dc:creator><![CDATA[mlohbihler]]></dc:creator><pubDate>Tue, 22 Apr 2014 23:41:03 GMT</pubDate></item><item><title><![CDATA[Reply to StreamTransport null pointer exception on Tue, 22 Apr 2014 11:16:52 GMT]]></title><description><![CDATA[<p dir="auto">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.</p>
]]></description><link>https://forum.mango-os.com/post/8502</link><guid isPermaLink="true">https://forum.mango-os.com/post/8502</guid><dc:creator><![CDATA[statisticblogs]]></dc:creator><pubDate>Tue, 22 Apr 2014 11:16:52 GMT</pubDate></item><item><title><![CDATA[Reply to StreamTransport null pointer exception on Sat, 19 Apr 2014 11:56:30 GMT]]></title><description><![CDATA[<p dir="auto">I've just come across this error from 2011 and I only downloaded the code a few days ago.</p>
<p dir="auto">Why was this error still present in the code?</p>
<p dir="auto">Anyway, the fix sorted the issue and I now have a working RTU slave.</p>
]]></description><link>https://forum.mango-os.com/post/8501</link><guid isPermaLink="true">https://forum.mango-os.com/post/8501</guid><dc:creator><![CDATA[v8dave]]></dc:creator><pubDate>Sat, 19 Apr 2014 11:56:30 GMT</pubDate></item><item><title><![CDATA[Reply to StreamTransport null pointer exception on Tue, 01 Feb 2011 15:12:01 GMT]]></title><description><![CDATA[<p dir="auto">There is a line in SerialSlave that should be removed.</p>
<pre><code>        try {
            serialPort = SerialUtils.openSerialPort(serialParameters);
            transport = new StreamTransport(serialPort.getInputStream(), serialPort.getOutputStream());
            transport.start(&amp;quot;Modbus4J SerialSlave&amp;quot;);  // &amp;lt&amp;lt&amp;lt REMOVE THIS LINE
        }

</code></pre>
<p dir="auto">The start method should be (and is) called in subclasses. I'm pretty sure this will fix the problem, but i don't have any equipment available to test on. Please let me know if it helps.</p>
]]></description><link>https://forum.mango-os.com/post/5320</link><guid isPermaLink="true">https://forum.mango-os.com/post/5320</guid><dc:creator><![CDATA[mlohbihler]]></dc:creator><pubDate>Tue, 01 Feb 2011 15:12:01 GMT</pubDate></item></channel></rss>