!! 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.

cd webapps/ROOT
mv index.html manage.html

Create an index.html page in that directory with the following:

{{{
<html>
<head>
<meta http-equiv="refresh" content="0;URL=http:myapp/">
</head>
<body>
</body>
</html>
}}}

Make sure to change "myapp" in the above XML.

You can still access tomcat manager with {{{http://mydomain/manage.html}}}

If you also switch to https you must use the whole URL.  You can, however,
auto-forward to the HTTP address and then have tomcat switch to HTTPS.

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

! 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 big where it can't create a GUID for localhost

{{{
ifconfig
uname -n
}}}

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