!! Tomcat

! Setting up an administrative user

File:  conf/tomcat-users.xml

{{{
<tomcat-users>
  <role rolename="manager"/>
  <role rolename="admin"/>
  <user username="admin" password="xxxxx" roles="admin,manager"/>
</tomcat-users>
}}}

-------------------

! Applications

Applications are stored under the {{{webapps}}} directory.
-----------------
! Tomcat on an Apple Mac

Make sure you have Java 6 selected through Applications / Utils / Java Preferences

Add the following to bin/startup.sh

{{{export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home}}}

------------------------

! Fixing a bad time zone

File:  bin/startup.sh

{{{
export TZ='US/Eastern'
}}}

----------------------

! Arahant specific parameters

File:  bin/startup.sh

{{{export CATALINA_OPTS="-Xms256M -Xmx1424M -XX:MaxPermSize=256M"}}}

You can also add the following to that line to monitor the Java GC:

{{{-Xloggc:/home/arahant/tomcat/logs/gc.log}}}

You can also add the following line to the same file in order to clear out old log files:

{{{rm -f ../logs/*}}}

On Windows servers:

Environment variables don't work.
Use the Tomcat config utility (Start / Programs / ...).
Define min & max memory in the text box.
Define -XX parameter in the listbox.

----------------------------

! To make shared libraries work

File:  conf/catalina.properties

{{{shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar}}}

------------------------------

! Changing the default webapp

This allows the user to type in the URL without having to add {{{/webapp}}} to the end.

First, the application __cannot__ be under the {{webapps}} directory.  It needs to be moved to a different location.

Edit {{conf/server.xml}} as follows.  Just prior to the line with {{</Host>}}, add the following:

{{{
<Context path="" docBase="/home/arahant/myapplication">
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
}}}

--------------------------------

! Auto-starting Tomcat on Linux servers

Add the following line to {{{/etc/rc.local}}} to auto-start tomcat before
the line with "exit 0".

{{{/home/arahant/tomcat/bin/startup.sh}}}

----------------------------

! Making Tomcat forget about old apps

{{{
rm -rf tomcat/conf/Catalina/localhost
}}}

------------------------------

! Fixing the bug where it can't create a GUID for localhost

{{{
ifconfig
uname -n
}}}

Put that name and IP address in {{{/etc/hosts}}}