0

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\\
Brucebayne
  • 39
  • 3
  • 1) can you check which user is controlling the tomcat-server service? a local account or a domain account? 2) has this user access-right to the shared folder? –  Mar 26 '20 at 12:35
  • 1.) It says Local System. account. 2.) Need to check that, probably I can add users. – Brucebayne Mar 26 '20 at 12:51
  • Figurate out, it is a tomcat service user access right problem. Thanks a lot ! – Brucebayne Mar 26 '20 at 15:35
  • cheers, you may hit the button "this comment adds something useful to the post" –  Mar 26 '20 at 15:44

0 Answers0