/Project ...">

Jcifs.smb.SmbException: network name not found

Below is the code snippet

SmbFile catalExp = new SmbFile("smb://<Shared machine name>/Project share/Home/4.  Folders/planning - Design & Exec/sample.txt",
                    new NtlmPasswordAuthentication(LoadProp.getShrdDomain(),"user","paswd"));

      

In this I get the error

jcifs.smb.SmbException: The network name cannot be found
    at jcifs.smb.SmbTransport.send(SmbTransport.java:753)
    at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:140)
    at jcifs.smb.SmbSession.send(SmbSession.java:103)
    at jcifs.smb.SmbTree.treeConnect(SmbTree.java:132)
    at jcifs.smb.SmbFile.connect(SmbFile.java:674)
    at jcifs.smb.SmbFile.connect0(SmbFile.java:644)
    at jcifs.smb.SmbFile.open0(SmbFile.java:700)
    at jcifs.smb.SmbFile.createNewFile(SmbFile.java:2027)

      

Is it something to do with the user rights of this shared shared folder or I am doing something wrong Please advise

+3


source to share


3 answers


I ran into this error message and it turned out that the problem was that my network path was wrong. You want to make sure that the object is NtlmPasswordAuthentication

configured correctly, that your network path is correct, and that you have set the jcifs.netbios.wins property correctly as shown in the first example on this page .

For example, to load a remote properties file:

final NtlmPasswordAuthentication AUTH = new NtlmPasswordAuthentication("domainname", "username", "password");

Config.setProperty("jcifs.netbios.wins", "10.10.1.1");

Properties props = new Properties();
InputStream in = new SmbFileInputStream(new SmbFile("smb://10.10.1.1:445/rootfolder/path/filename.properties", AUTH));
props.load(in);

      

(you need to add try / catch and input stream closure)

A good way to make sure all of your options are correct is to check your login and locate the file using the smb / cifs client. For example smbclient on linux / unix:



smbclient -Uusername -p 139 //10.10.1.1/rootfolder

      

The domain is displayed at the top when logging into smbclient:

Domain=[DOMAINNAME]

      

.. and you can navigate to your file to make sure you have the correct path.

+2


source


Well, I get this error too, but only on one device my code, which works on Android 4.04,

 String strprog = "STRING CREATED| "; //debug log string
    try {
        strprog += "NTLM| ";
        NtlmPasswordAuthentication auth =  new NtlmPasswordAuthentication("username:password");
        strprog += "SMB| ";
        SmbFile file = new SmbFile("smb://<pcname>/foldername/filename.txt",auth);

        strprog += "EXIST| ";
        String there = String.valueOf(file.exists());

        strprog += "View| ";
        TextView pp;
        pp = (TextView) findViewById(R.id.tv);
        pp.setText(there);



    } catch (Exception e) {
        // TODO Auto-generated catch block
        strprog += "ERROR! ";
        TextView ll;
        ll = (TextView) findViewById(R.id.tv);


        ll.setText(strprog + e.getStackTrace().toString() + "    " +  e.getMessage() + "   " + e.getLocalizedMessage() );
    }

      



The only difference I can see is where you have NtlmPasswordAuth

compared to mine. But as I said for some reason, this param

dumps zero input to Andriod 2.0 as I dive deeper than smb: //, but I hope this helps you.

0


source


I had this problem and it turned out that I didn't see which share name was mapped to my Windows share ... So, using Mac OS, I ran:

smbutil view smb://MYUSERNAME@HOSTNAME

After I was prompted for a password, I displayed a list of name names (which weren't obvious when I looked at this stuff using Windows). Once I found my name, it was as easy as using this when connecting with JCIFS:

new SmbFile("smb://HOSTNAME/SHARENAME/path/I/was/trying/to/access", auth);

0


source







All Articles