I have a problem that when running deployed on tomcat 8.5.9, I get access denied, and I can't create a file on a shared network folder. Running locally everything works perfectly.
I have tried cmd dir \\10.65.161.93\c$\tscape\download from the machine where it is deployed and I get all the files there, no problems. Probably there is some problem with tomcat, but I couldn't find the right answer. Machine is Windows Server 2012 R2.
java.io.FileNotFoundException: \10.65.161.93\c$\tscape\download\Test_test.txt (Access is denied) java.io.FileNotFoundException: \10.65.161.93\c$\tscape\download\Test_test.txt (Access is denied) at java.base/java.io.FileOutputStream.open0(Native Method) at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298) at java.base/java.io.FileOutputStream.(FileOutputStream.java:237) at java.base/java.io.FileOutputStream.(FileOutputStream.java:187)...
@Value("${export.machine}")
private String exportMachine;
@Value("${filename.lsps}")
private String filenameLSPS;
private void exportFile(String csv) {
File file = new File(exportMachine+filenameLSPS);
FileWriter writer;
try {
writer = new FileWriter(file);
writer.write(csv);
writer.close();
} catch (IOException ex) {
log.error(ex.toString(), ex);
}
}
and yaml config:
filename.lsps=Test_test.txt
export.machine=\\\\10.65.161.93\\c$\\tscape\\download\\