tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Separation of CATALINA_HOME and CATALINA_BASE
Date Mon, 03 Nov 2014 21:08:00 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Vince,

On 11/3/14 2:38 PM, vince.webb@thomsonreuters.com wrote:
> On the subject of "Newbie-friendly", I think Tomcat would be a 
> whole lot more friendly if CATALINA_HOME and CATALINA_BASE were 
> always totally separate with a minimum of overlap.
> 
> Although I used Tomcat quite a lot years ago I still consider 
> myself a Tomcat Newbie, mostly because configuration always took 
> days or weeks longer than is reasonable. Now I'm back to Tomcat 
> after years of having it easy using GlassFish. The files might be 
> different now but the grief with configuration is still the same.
> 
> I've been through numerous configurations with various versions of
>  Tomcat 7 and 8 the furthest I've got is getting a database 
> connection to work. Now having created a minimal CATALINA_BASE
> I've jumped a few steps back and it won't start.
> 
> I am sure many of the problems would evaporate if only there were 
> built in and permanent clarity over the separation between 
> CATALINA_HOME and CATALINA_BASE.

Here's my (simplified) prepare-local-tomcat target from our ant build
scripts. It takes a CATALINA_HOME and builds a CATALINA_BASE from it
and our other revision-controlled configuration files.

app.tomcat-home is CATALINA_HOME
app.home.dir is CATALINA_BASE
app.foo.dir should be obvious from the name/usage
conf.dir is our revision-controlled stuff

  <target name="prepare-local-tomcat">
    <mkdir dir="${app.home.dir}" />
    <mkdir dir="${app.conf.dir}" />
    <mkdir dir="${app.webapps.dir}" />
    <mkdir dir="${app.log.dir}" />
    <mkdir dir="${app.temp.dir}" />

    <!-- Prepare and install Tomcat configuration files for the
application -->

    <!-- Copy the stock web.xml from the tomcat installation -->
    <copy
        file="${app.tomcat-home}/conf/web.xml"
        tofile="${app.conf.dir}/web.xml"
    />

    <!--
        Copy tomcat-server.xml to server.xml in the local Tomcat conf dir.
        Use filters to substitute-in the values for the connector and
shutdown
        ports.
    -->
    <copy

file="${conf.dir}/${app.release-type}/tomcat-server-${app.tomcat-version}.xml"
      tofile="${app.conf.dir}/server.xml"
      filtering="yes"
    />
  </target>


Basically, all a CATALINA_BASE needs is conf/server.xml, conf/web.xml,
a log directory, and a work directory. I haven't bothered checking,
but you might not even need conf/web.xml... Tomcat might automatically
use the CATALINA_HOME/conf/web.xml if there isn't one in
CATALINA_BASE/conf/web.xml.

We still use "webapps" though we could deploy anywhere we wanted to.

> Yes, I've read RUNNING.TXT and I'm left wondering why do I have a 
> catalina class not found if all the tomcat jar files are in 
> CATALINA_HOME/lib
> 
> Using CATALINA_BASE:   "C:\tomcat8catalina_base" Using 
> CATALINA_HOME:   "C:\tomcat809" Using CATALINA_TMPDIR: 
> "C:\tomcat8catalina_base\temp" Using JRE_HOME: "C:\jdk1.7.0_55"
> Using CLASSPATH: 
> "C:\tomcat809\bin\bootstrap.jar;C:\tomcat8catalina_base\bin\tomcat-juli.jar"
>
>
> 
Listening for transport dt_shmem at address: tomcat_shared_memory_id
> 03-Nov-2014 17:45:50.410 SEVERE [main] 
> org.apache.tomcat.util.digester.Digester.startElement Begin event 
> threw exception java.lang.ClassNotFoundException: 
> org.apache.catalina.startup.VersionLoggerListener

It looks like you are trying to use the server.xml file from Tomcat
8.0.14 on Tomcat 8.0.9. The VersionLoggerListener class was introduced
relatively recently.

If you want to adapt server.xml from one version of Tomcat to another,
you should be careful. You have inadvertently downgraded your Tomcat
instance and lost functionality.

So, basically, you have damaged your Tomcat installation and want to
know why it doesn't work. Well, you broke it, so it doesn't work.

> All these experiments are done running Tomcat under NetBeans so 
> perhaps part of my issue is with NetBeans. The CLASSPATH shown 
> above is a bit on the short side, is it meant to be so short ?

Yes. Tomcat's CLASSPATH includes only things within CATALINA_HOME/bin
and CATALINA_BASE/bin (in that order). Everything else (like the stuff
in CATALINA_HOME/lib and CATALINA_BASE/lib) gets added to a
ClassLoader that is used after the server bootstraps itself.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUV+6wAAoJEBzwKT+lPKRYFrkP/iLMieBMpVuAW2FQohnJ+slQ
wgCN3kjuK3JCip1zVHZzUWvS2x0hDs+XWrNDLGtk36NDH9++k5z94GQjVukn5vFa
yaRKADjmNuLSzEj4dPbj7mFz3Vj0lmkxLLvuslyMQZe9WKqE7qeo8q0aw5v2M1uc
h5jZuCS54HdTbioXx2++YeQEaT1jqw6Iuk4acWkaKWS+8B/epXqMHh0yNBkI50un
EY+YwOJ1MQ5WbDEFw/nRUkbVMMQHpY6uWPxkqu5Te+JaUPRlnHD6qzhQCCjDJ92y
zGnGLkE5koo+cVCpVKosznJCw/ZCnf4Pub7NqtPysXe7smVBrCzMvQ1+IjDw4rUi
KK/e+9DtCLhq3HVcY4Nc03xycqADGMVeyASJgdf+ONRS7QhGFh7JJgSw+Xwfk9tM
Wu0VB3W2iC87F8Iag6prowFav7AYt4MmYuY224emaOVhmnOgHHGYi+DDAABw6dK9
KCPnFg6IOJaOUuNpCY6UHebVyVibglCsNZTrqRWX0o7vKYnDinEtL8YqwYrgfHZc
9E5RUJJ3kvz+Ptx2mkopS+JLx9Yll1bkOjPjC2k0kesc2gVknlRXzkjYO2I+VxGR
b64UnEklwLMkDOBpF2kz/K57sYbPxxR5oJfi3CAGs0ixENyamLWXv3i9d8CXcf+Z
0+p5tBXbSTqc3ettoBxv
=Vx6D
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message