Domanda

I have a JSP running on Tomcat 6.0.26 (windows server 2008 r2 sp1) that has a samba (jcifs-1.3.17.jar) connection to list files found on a remote server.

This worked without any problems until the AD controller was updated to Windows 2012 (fully patched).

Now, I can't list the files on the Samba Share anymore.

SmbFile sfFile = new SmbFile("smb://myserver.com/share/", "subfolder", new NtlmPasswordAuthentication("MYDOM", session.getAttribute("UserID").toString(), session.getAttribute("UserCode").toString()));
SmbFile[] asfDirectoryList = sfFile.listFiles("webversion" + session.getAttribute("PLCode").toString().substring(0,3) + "*.xls");

The second line returns following exception:

    org.apache.jasper.JasperException: jcifs.smb.SmbException: The network name cannot be found.
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:407)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause 

    jcifs.smb.SmbException: The network name cannot be found.
    jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:563)
    jcifs.smb.SmbTransport.send(SmbTransport.java:663)
    jcifs.smb.SmbSession.send(SmbSession.java:238)
    jcifs.smb.SmbTree.treeConnect(SmbTree.java:176)
    jcifs.smb.SmbFile.doConnect(SmbFile.java:911)
    jcifs.smb.SmbFile.connect(SmbFile.java:954)
    jcifs.smb.SmbFile.connect0(SmbFile.java:880)
    jcifs.smb.SmbFile.resolveDfs(SmbFile.java:669)
    jcifs.smb.SmbFile.send(SmbFile.java:773)
    jcifs.smb.SmbFile.doFindFirstNext(SmbFile.java:1986)
    jcifs.smb.SmbFile.doEnum(SmbFile.java:1738)
    jcifs.smb.SmbFile.listFiles(SmbFile.java:1715)
    jcifs.smb.SmbFile.listFiles(SmbFile.java:1681)
    org.apache.jsp.financials.frFinancialsFileListing_jsp._jspService(frFinancialsFileListing_jsp.java:220)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Does anyone know why this would happen and how to fix it?

[EDIT] The mystery: Updating the AD controller to Windows 2012 should not have an effect on a webserver accessing a share on a fileserver (both of which are running windows 2008 r2 sp1). I just cannot understand that.

È stato utile?

Soluzione

With Windows Server 2012 R2 the SMB 1.0 has been disabled by default. Therefore you need to activate the SMB 1.0 again in Windows Server 2012 R2.

  1. Open the Add Roles and Features Wizard of Windows and check if the SMB 1.0/CIFS File Shareing Support is activated: enter image description here
  2. Enable the SMB 1.0 Support by opening the Registry Editor. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer and change the value of DependOnService from SamSS Srv2 to SamSS Srv enter image description here
  3. Restart Windows

You can verify if the support is activated by checking the properties of the system service Server (LanmanServer) in the tab Dependencies that SMB 1.xxx is also activated: enter image description here

Source: http://woshub.com/smb-1-0-support-in-windows-server-2012-r2/#!prettyPhoto

Altri suggerimenti

For anyone else having this problem, here is what happened.

It looks like Microsoft has released a patch that ends backward compatibility beyond SMB2. So, JCIFS will no longer work because it is SMB1.

In my case I was able to remove the need for JCIFS by removing the need to authenticate access to the share. These files do not hold state secrets so allowing everyone on the internal network read rights was not an issue. So now use of the standard file object from java.io is possible to access the share. That object passes file handling off to the OS (2008 r2 sp1) meaning the JCIFS lib is not used/needed at all.

Windows Server 2012 includes latest version of SMB protocol 3.0 and it full of really interesting updates and improvements (details and some relevant discussion here). As with any serious improvements there is a compromise in terms of legacy clients support.

Probably there is no support for SMB 3.0 on your Samba client side or some backward compatibility should be enabled on Server 2012 side.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top