Error while trying to deploy WAR on Tomcat8 on Ubuntu 15.04

感情迁移 提交于 2019-12-13 02:04:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!