系统版本:16.04.4
sudo apt-get install tomcat7
直接tomcat启动提示JAVA_HOME环境没有配置
sudo apt-get install oracle-java8-installer
通过这个命令可以看到java安装路径:
sudo update-alternatives --config java
直接设置/etc/enviroment没有作用
sudo vi /etc/default/tomcat7
打开JAVA_HOME=.....的注释,并正确配置JAVA_HOME
JAVA_HOME=/usr/lib/jvm/java-8-oracle
启动后边提示fail记得查看日志,看看端口是否冲突
日志中有下面的警告信息
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
解决:
cd /usr/share/tomcat7
sudo ln -s /var/lib/tomcat7/common common
sudo ln -s /var/lib/tomcat7/server server
sudo ln -s /var/lib/tomcat7/shared shared
最后出现的警告信息:
WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []
尚未解决
转载于:https://blog.51cto.com/xiaoxiaozhou/2105741