Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What sets ${catalina.home} in Tomcat 6 config files?

Tags:

tomcat

tomcat6

I'm trying to adapt some old build scripts to run with an RPM installation of Tomcat 6, and I'm running into the following:

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)

This is unsurprising as Tomcat is not in /var/lib/tomcat6, it's in /usr/share/tomcat6. When I look for where this might be coming from, all I find is the following in a file called host-manager.xml:

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

</Context>

Now, I have $CATALINA_HOME set to /usr/share/tomcat6 as it should be, and there's no references to /var/lib anywhere in either my web app (including config) or my Tomcat 6 installation, as far as I can tell. So what is ${catalina.home}, and how is /var/lib/tomcat6 getting substituted for it?

like image 707
David Moles Avatar asked Mar 30 '12 17:03

David Moles


1 Answers

Look in your ${TOMCAT_HOME}/bin/catalina.sh file - scroll down to the start section - the catalina.home system property is set from the CATALINA_HOME env variable:

-Dcatalina.home=\"$CATALINA_HOME\"

Now as to why this is not the same as what you have CATALINA_HOME env variable set to - you'll need to check to see how your tomcat server is started, in particular what environment variables are set in the process / context that it is launched from.

So how are you starting your tomcat instance?

like image 59
Chris White Avatar answered Oct 06 '22 18:10

Chris White