部署时,netbeans 无法将上下文 xml 文件从临时文件夹复制到 tomee 的本地主机。 FileNotFoundException(访问被拒绝)
netbeans unable to copy context xml file from temp folder to tomee's localhost when deploy. FileNotFoundException(access denied)
部署时,netbeans 无法将上下文 xml
文件从 AppData\Local\Temp\
文件夹复制到 tomee
的 conf\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)
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
部署时,netbeans 无法将上下文 xml
文件从 AppData\Local\Temp\
文件夹复制到 tomee
的 conf\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)
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 directoryAppData\Local\Temp\
.
- Specifying the Tomee runs the service with the LocalSystem account when installing the service.
service install %serviceName% --service-user LocalSystem