<div dir="ltr"><div>Hey all,</div><div><br></div><div>This email is primarily to help everyone avoid a headache.  We use JCIFS in some of our on-prem software for collecting logs, and one of our customers reported that they couldn't connect to a share on their Windows 2012 Server using JCIFS.  I looked at the logs and found this exception:</div><div><br></div><div>jcifs.smb.SmbException: Failed to connect: <a href="http://server.company.com/192.168.111.222">server.company.com/192.168.111.222</a></div><div>jcifs.util.transport.TransportException</div><div>java.net.SocketException: Software caused connection abort: recv failed</div><div><span class="" style="white-space:pre">  </span>at java.net.SocketInputStream.socketRead0(Native Method)</div><div><span class="" style="white-space:pre">   </span>at java.net.SocketInputStream.read(Unknown Source)</div><div><span class="" style="white-space:pre"> </span>at java.net.SocketInputStream.read(Unknown Source)</div><div><span class="" style="white-space:pre"> </span>at jcifs.util.transport.Transport.readn(Transport.java:29)</div><div><span class="" style="white-space:pre"> </span>at jcifs.smb.SmbTransport.peekKey(SmbTransport.java:388)</div><div><span class="" style="white-space:pre">   </span>at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:288)</div><div><span class="" style="white-space:pre"> </span>at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:319)</div><div><span class="" style="white-space:pre"> </span>at jcifs.util.transport.Transport.run(Transport.java:241)</div><div><span class="" style="white-space:pre">  </span>at java.lang.Thread.run(Unknown Source)</div><div> </div><div><span class="" style="white-space:pre">   </span>at jcifs.util.transport.Transport.run(Transport.java:258)</div><div><span class="" style="white-space:pre">  </span>at java.lang.Thread.run(Unknown Source)</div><div> </div><div><span class="" style="white-space:pre">   </span>at jcifs.smb.SmbTransport.connect(SmbTransport.java:309)</div><div><span class="" style="white-space:pre">   </span>at jcifs.smb.SmbTree.treeConnect(SmbTree.java:156)</div><div><span class="" style="white-space:pre"> </span>at jcifs.smb.SmbFile.doConnect(SmbFile.java:911)</div><div><span class="" style="white-space:pre">   </span>at jcifs.smb.SmbFile.connect(SmbFile.java:954)</div><div><span class="" style="white-space:pre">     </span>at jcifs.smb.SmbFile.connect0(SmbFile.java:880)</div><div><span class="" style="white-space:pre">    </span>at jcifs.smb.SmbFile.exists(SmbFile.java:1415)</div><div><span class="" style="white-space:pre">     </span>at com.company.collector.common.SmbFileWrapper.exists(SmbFileWrapper.java:56)</div><div><span class="" style="white-space:pre">      </span>at com.company.collector.datasource.dirwatcher.impl.DirectoryWatcher.checkDirectory(DirectoryWatcher.java:178)</div><div><span class="" style="white-space:pre">     </span>at com.company.collector.datasource.dirwatcher.impl.DirectoryWatcher.initializeHandler(DirectoryWatcher.java:166)</div><div><span class="" style="white-space:pre">  </span>at com.company.collector.datasource.dirwatcher.impl.DirectoryWatcher.start(DirectoryWatcher.java:108)</div><div><span class="" style="white-space:pre">      </span>at com.company.collector.datasource.dirwatcher.impl.DirectoryWatcher.run(DirectoryWatcher.java:86)</div><div><span class="" style="white-space:pre"> </span>at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)</div><div><span class="" style="white-space:pre">     </span>at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)</div><div><span class="" style="white-space:pre">   </span>at java.util.concurrent.FutureTask.runAndReset(Unknown Source)</div><div><span class="" style="white-space:pre">     </span>at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)</div><div><span class="" style="white-space:pre"> </span>at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)</div><div><span class="" style="white-space:pre">        </span>at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)</div><div><span class="" style="white-space:pre">       </span>at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)</div><div><span class="" style="white-space:pre">      </span>at java.lang.Thread.run(Unknown Source)</div><div><br></div><div>I noticed that this stack trace indicates that it's the client or remote server, not JCIFs, that's the issue.  I searched for hours, but there's nothing about this error and JCIFS, or even this error and samba as far as I could tell.  After some poking around on their part using something called "Best Practices Analyzer", they found that the system process Srv.sys was not running.  As detailed in some Microsoft documentation, when this service is not running, clients cannot connect to the remote share.  I wouldn't have emailed about a non-jcifs specific issue, but since I couldn't find a single shred of information about this on the web, I figured I'd send this to the list to spread the knowledge and record this for posterity.</div><div><br></div><div>Here's the Microsoft Documentation about it:</div><div><a href="http://social.technet.microsoft.com/wiki/contents/articles/21104.srv-sys-should-be-set-to-start-on-demand.aspx">http://social.technet.microsoft.com/wiki/contents/articles/21104.srv-sys-should-be-set-to-start-on-demand.aspx</a><br></div><div><br></div><div>-Andre</div></div>