My question would be, how is the recommended way to access Windows shares, also in view of future demads. Of course, I'm also happy about an explanation or code snippet of how the library, which is mentioned in the following , can be used under cache.
The classic jcifs library is easy to use, also with Cache, but as microsoft ceases support for smb1, we are currently looking for alternatives. jcifs-ng is such a library, which we took a closer look at. In java code a jcifs-ng file operation looks like this:
CIFSContext baseCtx = new BaseContext(new PropertyConfiguration(System.getProperties()));
NtlmPasswordAuthenticator creds = new NtlmPasswordAuthenticator(smbDomain,smbUser,smbPass);
CIFSContext ct = baseCtx.withCredentials(creds);
SmbResource sr = ct.get(smbConnect);
// do something with the SmbRessource which can be either a file or a directory
In contrast to the old jcifs library, interfaces are used, e.g. with CIFSContext. I don't know if this is the reason, but it seems to cause problems using the JavaGateway Wizard and the wrapper classes it creates. Creating an empty Properties hashmap and instatiating an NtlmPasswordAuthenticator works fine but when calling the method baseCtx.withCredentials(creds), which result-type is an abstract CIFSContext, the csession runs into an exception.
Thank you very much,