How to Use SMBv2 with Java 7 to read file from Protected Network Drive within My company network

38 Views Asked by At

I am trying since several days. Previously I was using JCIFS library to read data from network path using username and password and It was working fine Because that Network Location was supporting SMBv1 But Now they have changes that shared location to new path and That only support SMBv2 or higher. And the Problem is that our application only support Java 7 because It is legacy application. So Can anyone help me to read csv file using Java 7 with SMBv2 support.

I have tried JCIFS-ng ---------> It is giving java error because It supports Java 8 or Higher I have tried SMBJ ------> It is also giving java error because It supports Java 8 or Higher.

Any other Libraries i am not able to find over the internet. So not sure whether it is even possible or not with Java 7. And we can not use Java 8 or higher because of Application constarints.

using JCIFS library I am getting below error

jcifs.smb.SmbException: Failed to connect to server
java.net.UnknownHostException: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    at jcifs.UniAddress.getAllByName(UniAddress.java:315)
    at jcifs.smb.SmbFile.getFirstAddress(SmbFile.java:864)
    at jcifs.smb.SmbFile.connect(SmbFile.java:951)
    at jcifs.smb.SmbFile.connect0(SmbFile.java:880)
    at jcifs.smb.SmbFile.open0(SmbFile.java:972)
    at jcifs.smb.SmbFile.open(SmbFile.java:1006)
    at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:73)
    at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:65)
    at jcifs.smb.SmbFile.getInputStream(SmbFile.java:2844)
    at Demo.main(Demo.java:23)

    at jcifs.smb.SmbFile.connect0(SmbFile.java:882)
    at jcifs.smb.SmbFile.open0(SmbFile.java:972)
    at jcifs.smb.SmbFile.open(SmbFile.java:1006)
    at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:73)
    at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:65)
    at jcifs.smb.SmbFile.getInputStream(SmbFile.java:2844)
    at Demo.main(Demo.java:23)

I have tried JCIFS library and SMBJ. One is not supporting SMBv2 and one is not supporting Java 7

0

There are 0 best solutions below