有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java netbeans在部署时无法将上下文xml文件从临时文件夹复制到tomee的本地主机。FileNotFoundException(拒绝访问)

部署时,netbeans无法将上下文xml文件从AppData\Local\Temp\文件夹复制到tomeeconf\Catalina\localhost

已经尝试过:

deploy to tomee 7.0.X is fine but tomee 8.0.0 fail.

stderr.log中出现致命错误:

03-Oct-2019 16:31:22.358 fatal [http-nio-9200-exec-6] org.apache.catalina.startup.ExpandWar.copy Error copying [C:\Users\xxx\AppData\Local\Temp\context2716699461818377726.xml] to [D:\Tomee\apache-tomee-plus-8.0.0\conf\Catalina\localhost\myApp.xml] java.io.FileNotFoundException: C:\Users\xxx\AppData\Local\Temp\context2716699461818377726.xml (Access is denied.) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.(FileInputStream.java:138) at org.apache.catalina.startup.ExpandWar.copy(ExpandWar.java:276)


共 (1) 个答案

  1. # 1 楼答案

    This problem only occurs when Tomee is running as a Windows service.
    I tested version 7.0.4~8.0.0 to get the following conclusions.

    The Tomee runs the service with the LocalSystem account before version 7.0.6.
    Starting with version 7.0.6, the service is run with the LocalService account, so that the permissions are insufficient.

    The following two ways can solve the issue:
    - Give the LocalService account access to the directory AppData\Local\Temp\.
    - Specifying the Tomee runs the service with the LocalSystem account when installing the service.
       service install %serviceName% service-user LocalSystem