问题
I am trying to deploy a .war file using Tomcat8, Apache, and Ubuntu 15.04. When I click "Select WAR file to upload" in the /manager section of tomcat I get the following error:
FAIL - Deploy Upload Failed, Exception: java.io.FileNotFoundException: /opt/tomcat/webapps/musicStore.war (Permission denied)
How would I fix this?
回答1:
Converting comments to an answer, adding more information:
Your /opt/tomcat/webapps
directory belongs to someone (execute ls -l /opt/tomcat/webapps
to see whom it belongs to).
While tomcat is running, execute ps aux | grep catalina
to see which user is running tomcat (depends on the way you start it - might be your own current user). You could chown <thatuser> /opt/tomcat/webapps
. However, for production systems I'd strongly recommend to not have the manager application running and tomcat's own directory writeable to itself. It opens up quite a few attack vectors and is bad practice IMHO
If it's a local development system, comfort typically trumps security - and you might opt for keeping the manager app.
To mitigate the potential manager-app problems in production, at least limit access to known IP-Addresses, keep the user database well maintained (not in tomcat-users.xml with clear text passwords). However, on my production systems, tomcat can not write to its own webapps directory - thus hot deployment of applications through the manager app won't work anyways...
来源:https://stackoverflow.com/questions/34642211/error-while-trying-to-deploy-war-on-tomcat8-on-ubuntu-15-04