[jcifs] Opening connection to server taes about 15 seconds

Jose Luis Martinez Avial jlmartinez at bpi-gruposantander.com
Fri Oct 28 11:03:29 MDT 2011


Hi Mike,
	After all it seems it was a momentarily problem with the network, since it is working fine now. Only issue, is that I setup the loglevel to 3, and I'm getting a whole bunch of error messages like this(but the file is written correctly):

jcifs.smb.SmbException: The system cannot find the file specified.
        at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:542)
        at jcifs.smb.SmbTransport.send(SmbTransport.java:619)
        at jcifs.smb.SmbSession.send(SmbSession.java:242)
        at jcifs.smb.SmbTree.send(SmbTree.java:111)
        at jcifs.smb.SmbTransport.getDfsReferrals(SmbTransport.java:684)
        at jcifs.smb.Dfs.getTrustedDomains(Dfs.java:64)
        at jcifs.smb.Dfs.resolve(Dfs.java:146)
        at jcifs.smb.SmbFile.resolveDfs(SmbFile.java:666)
        at jcifs.smb.SmbFile.send(SmbFile.java:726)
        at jcifs.smb.SmbFile.open0(SmbFile.java:933)
        at jcifs.smb.SmbFile.open(SmbFile.java:950)
        at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:142)
        at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:97)
        at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:67)
        at com.spb.eco.services.customer.action.SignDocumentAction.saveFileToOptika(SignDocumentAction.java:99)
jcifs.smb.SmbException: The system cannot find the file specified.
        at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:542)
        at jcifs.smb.SmbTransport.send(SmbTransport.java:619)
        at jcifs.smb.SmbSession.send(SmbSession.java:242)
        at jcifs.smb.SmbTree.send(SmbTree.java:111)
        at jcifs.smb.SmbTransport.getDfsReferrals(SmbTransport.java:684)
        at jcifs.smb.Dfs.getTrustedDomains(Dfs.java:64)
        at jcifs.smb.Dfs.resolve(Dfs.java:146)
        at jcifs.smb.SmbFile.resolveDfs(SmbFile.java:666)
        at jcifs.smb.SmbFile.send(SmbFile.java:726)
        at jcifs.smb.SmbFileOutputStream.writeDirect(SmbFileOutputStream.java:245)
        at jcifs.smb.SmbFileOutputStream.write(SmbFileOutputStream.java:216)
        at com.spb.eco.services.customer.action.SignDocumentAction.copy(SignDocumentAction.java:111
[...]

I'm copying writing the file just reading from an InputStream and writing to the SmbFileOutputStream:

    void copy(InputStream in, OutputStream out) throws IOException {
		// Transfer bytes from in to out
		byte[] buf = new byte[1024];
		int len;
		while ((len = in.read(buf)) > 0) {
			out.write(buf, 0, len);
		}
		in.close();
		out.close();
	}

It seems I'm getting a error log every time the out.write is hit. My question is: Is that stack trace normal? Am I missing something? And last, but not least, is this the better way to copy from a local File to a File in a shared folder?

Thanks

Jose Luis

-----Original Message-----
From: Michael B Allen [mailto:ioplex at gmail.com] 
Sent: Thursday, October 27, 2011 7:15 PM
To: Jose Luis Martinez Avial
Cc: jcifs at lists.samba.org
Subject: Re: [jcifs] Opening connection to server taes about 15 seconds

On Thu, Oct 27, 2011 at 12:20 AM, Jose Luis Martinez Avial <jlmartinez at pb-santander.com> wrote:
> Hi all,
>
>        I'm using jcifs 1.3.8 to save a document to a shared folder in 
> a windows server. For some reason the connection is taking about 15 
> seconds to be opened, while the copy itself is pretty much instantaneous.
>
>
>
> NtlmPasswordAuthentication auth = new 
> NtlmPasswordAuthentication("domain
> ","user","password");
>
> String path = "smb://x.x.x.x/eco/document.pdf";
>
> SmbFile sFile = new SmbFile(path, auth);
>
> SmbFileOutputStream sfos = new SmbFileOutputStream(sFile);
>
> [... write on the sfos ...]
>
> sfos.close();
>
>
>
> Any suggestion on where the problem may be?

Hi Jose,

I don't know. I would suspect it were a nameservice problem but if you're using an IP address that's not the problem. The best way to diagnose problems like this is to get a network packet capture and look at in WireShark (note: do not post packet captures to the mailing list).

Mike

--
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/

Internet communications are not secure and therefore Banco 
Santander International does not accept legal responsibility for 
the contents of this message. Any views or opinions presented 
are solely those of the author and do not necessarily represent 
those of Banco Santander International unless otherwise 
specifically stated. 

Las comunicaciones vía Internet no son seguras y, por lo tanto,
Banco Santander International no asume responsabilidad legal 
ni de ningún otro tipo por el contenido de este mensaje. 
Cualquier opinión transmitida pertenece únicamente al autor y 
no necesariamente representa la opinión de Banco Santander 
International, a no ser que esté expresamente detallado.


More information about the jCIFS mailing list