我认为这是一个好问题。
我也觉得很困惑。几分钟前我安装了Tomcat,然后发现它们有两个不同的“webapps”位置。
在 /usr/share/tomcat6/webapps/default_root/ 在 /var/lib/tomcat6/webapps/ROOT/
两者的内容相同,但都不是符号链接。
当我启动Tomcat时,它显示:
引用:
这是默认的Tomcat主页。它可以在本地文件系统上找到:/var/lib/tomcat6/webapps/ROOT/index.html
Tomcat6老手可能会高兴地发现,该Tomcat系统实例的CATALINA_HOME安装在/usr/share/tomcat6中,而CATALINA_BASE安装在/var/lib/tomcat6中。因此,基于这些信息,/usr/share/... 文件夹是为向后兼容而保留的,对吗?
但根据您发布的内容,库被读取自CATALINA_HOME而不是CATALINA_BASE。
也许他们仍然保留了这个默认引用,以防止其他系统在更新后停止工作?
好的观察!
更新:
我在 /usr/share/tomcat6/bin/catalina.sh 中读到了这个:
引用:
# CATALINA_HOME May point at your Catalina "build" directory.
#
# CATALINA_BASE (Optional) Base directory for resolving dynamic portions
# of a Catalina installation. If not present, resolves to
# the same directory that CATALINA_HOME points to.
当我们阅读/etc/init.d/tomcat6时:
(在开头处)
CATALINA_HOME=/usr/share/$NAME
(then...)
# Directory for per-instance configuration files and webapps
CATALINA_BASE=/var/lib/$NAME
但是,如果您尝试手动启动TOMCAT(就像我很久以前做的那样)使用以下命令:
sudo /usr/share/tomcat6/bin/startup.sh
将显示以下内容:
引用:
Using CATALINA_BASE: /usr/share/tomcat6
Using CATALINA_HOME: /usr/share/tomcat6
Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
Using JRE_HOME: /usr
touch: cannot touch `/usr/share/tomcat6/logs/catalina.out': No such file or directory
/usr/share/tomcat6/bin/catalina.sh: 357: cannot create /usr/share/tomcat6/logs/catalina.out: Directory nonexistent
为什么在这里将CATALINA_BASE设置为与CATALINA_HOME相同呢?
/usr/share/tomcat6/logs/不存在,但在/var/lib/tomcat6/logs/中存在。
我发现当从init.d脚本启动Tomcat时,我的日志会写入到/var/lib/... ,所以最好从那里启动它。