什么在Tomcat 6配置文件中设置$ {catalina.home}?

时间:2012-03-30 17:35:52

标签: tomcat tomcat6

我正在尝试使用Tomcat 6的RPM安装来调整一些旧的构建脚本,并且我遇到了以下问题:

java.lang.IllegalArgumentException: Document base /var/lib/tomcat6/webapps/host-manager does not exist or is not a readable directory
    at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4086)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4255)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)

这不足为奇,因为Tomcat不在/var/lib/tomcat6,而在/usr/share/tomcat6。当我查找它可能来自哪里时,我在host-manager.xml文件中找到以下内容:

<Context docBase="${catalina.home}/webapps/host-manager"
     privileged="true" antiResourceLocking="false" antiJARLocking="false">

</Context>

现在,我将$CATALINA_HOME设置为/usr/share/tomcat6,并且在我的网络应用(包括配置)或我的Tomcat 6安装中的任何地方都没有引用/var/lib,据我所知。那么什么是${catalina.home},以及/var/lib/tomcat6如何替代呢?

1 个答案:

答案 0 :(得分:10)

查看${TOMCAT_HOME}/bin/catalina.sh文件 - 向下滚动到开始部分 - catalina.home系统属性是从CATALINA_HOME env变量设置的:

-Dcatalina.home=\"$CATALINA_HOME\"

现在,为什么这与你设置的CATALINA_HOME env变量不同 - 你需要检查你的tomcat服务器是如何启动的,特别是在从中启动的进程/上下文。

那么你是如何启动tomcat实例的呢?