Child pages
  • Cleaning Tomcat for Redeployment
Skip to end of metadata
Go to start of metadata

Introduction

While it is often better to start with a fresh installation of Tomcat, sometimes it is useful to just clean out all traces of Sakai from Tomcat and redeploy.

Procedure for Sakai 11+

Tomcat 8

Shut Tomcat down. From the Tomcat directory:

  • components
    • Delete everything
  • endorsed (Sakai 12+ only)
    • Delete everything
  • lib
    • Delete everything except:
      • The original jars that came with Tomcat
        • Either keep a list of these and exclude them from the deletion (see Linux Tip below) or re-copy from a freshly-extracted Tomcat 8
      •  your database drivers (see Linux Tip below)
        • Note that if you are using the MariaDB driver shipped with Sakai 11, you can safely delete it and it will be restored when you deploy Sakai
      • For Linux (substituting ecj-<version>.jar, and <your database driver>); tested in tomcat 8.0.32, and tomcat 8.0.33:

        cd /opt/tomcat/lib
        shopt -s extglob
        rm -rf !(annotations-api.jar|catalina-ant.jar|catalina-ha.jar|catalina-storeconfig.jar|catalina-tribes.jar|catalina.jar|ecj-<version>.jar|el-api.jar|jasper-el.jar|jasper.jar|jsp-api.jar|servlet-api.jar|tomcat-api.jar|tomcat-coyote.jar|tomcat-dbcp.jar|tomcat-i18n-es.jar|tomcat-i18n-fr.jar|tomcat-i18n-ja.jar|tomcat-jdbc.jar|tomcat-jni.jar|tomcat-util-scan.jar|tomcat-util.jar|tomcat-websocket.jar|websocket-api.jar|<your database driver>)
  • temp
    • Delete everything
  • webapps
    • Keep ROOT (if you have it)
    • Delete everything else (see Linux Tip below)
  • work
    • Delete everything

Procedure for Sakai 10 and under

Tomcat 7/8

Shut Tomcat down. From the Tomcat directory:

  • common/lib:
    • Delete everything (Database drivers should be in lib, the other jars will be redeployed by Maven)
  • components
    • Delete everything
  • shared/lib
    • Delete everything
  • temp
    • Delete everything
  • webapps
    • Keep ROOT (if you have it)
    • Delete everything else (see Linux Tip below)
  • work
    • Delete everything

Tomcat 5.5

 Click here to expand...

Shut Tomcat down. From the Tomcat directory:

  • common/lib:
    • Delete sakai*.jar
  • components
    • Delete everything
  • conf/Catalina/localhost
    • Keep host-manager.xml, manager.xml
    • Delete everything else
  • server/lib
    • Delete sakai*.jar
  • shared/lib
    • Delete everything
  • temp
    • Delete everything
  • webapps
    • Keep ROOT (maybe balancer and webdav as well)
    • Delete everything else (see Linux Tip below)
  • work
    • Delete everything

 

This process could be automated with a script or Maven goal.

Linux Tip

Run the following commands to delete everything in webapps except the specified directories ROOT, balancer, and webdav. A similar command can be used to avoid deletion of database driver jars.

cd /opt/tomcat/webapps
shopt -s extglob
rm -rf !(ROOT|balancer|webdav)

References

  • No labels

7 Comments

  1. I did small changes to the document,good job Paul!

  2. Why do you keep "ROOT (maybe balancer and webdav as well)" in webapps?

    1. Mostly because they come default with a fresh (5.5) install, but also because you might have modified the contents of ROOT. For example, we have a redirect to /portal set up in ROOT on our dev servers.

    2. Yeah, I don't see a ROOT, balancer, or webdav in my setup at all.

  3. There's currently no mention of ${CATALINA_HOME}/server/lib

    Any suggestions for that one?

    FWIW, I have a public gist for a bash function that does this located here:

    https://gist.github.com/mtheoryx/5016451

    1. I would say it is safe to delete the contents of server/lib. Tomcat 7 doesn't have a server/lib directory by default. The 2.9 install guide has an optional step where this is created. I checked mine and there are no files in it after a fresh 2.9.1 deployment.

      1. It appears you're correct. I'll update my code to handle both circumstances.