wiki:TomcatManual

Tomcat Manual

Short manual on how to set up and configure a tomcat instance on your virtual server.

Create a Tomcat instance on vm7

Login onto your virtual server (credentials provided by our systems administrator Ger) and change to your home directory.

prompt> cd $HOME

Create your instance (replace myinstance with the name of your instance).

prompt> tomcat6-instance-create myinstance

This creates a tomcat instance in your home directory.

prompt> ls ./myinstance
bin conf logs temp webapps work

Create a Tomcat instance on application32

Login onto the server (credentials provided by our systems administrator Ger) and change to the directory:

prompt> cd /target/gpfs2/gcc/tomcat

Copy one of the existing directories to create the directory structure for your instance.

prompt> cp -R anexistinginstance myinstance

Configure a Tomcat instance

Your instance is created with the default settings. CATALINA_HOME is set to your instance directory.
However, the default ports are 8005 and 8080, which have to be changed in conf/server.xml
The port numbers have to be > 1024 and must not be used by anybody else on the server.
Afterwards add your choice to the table of port numbers/applications as a quick reference.

Server Server Port Connector Port Application WAR name Contact
vm7.target.rug.nl 8005 8080 Tomcat Ger
application32.target.rug.nl 7105 7180 COL7A1 rwagner
vm7.target.rug.nl 8006 6180 BBMRI bbmri_gcc.war antonakd
vm7.target.rug.nl 8007 5180 tomcat4animaldb gcc eroos
vm7.target.rug.nl 8305 8380 ngs_test rwagner
vm7.target.rug.nl 8405 8480 autodeploy eroos
vm7.target.rug.nl 7005 7080 c2cards rwagner
vm7.target.rug.nl 8889 8888 panacea jvelde
vm7.target.rug.nl - 9000 through 9020 xQTL apps and DesignGG jvelde
application32.target.rug.nl - 9000 through 9020 Reserved for xQTL / DesignGG / et al. jvelde
vm7.target.rug.nl 6405 6480 CVDB rwagner
vm7.target.rug.nl 7778 7777 Lifelines lifelines antonakd
vm7.target.rug.nl 9998 9999 compute compute george
vm7.target.rug.nl 7205 7280 CHD7 rwagner
vm7.target.rug.nl 7305 7380 humanpathwaydb rwagner + morris
vm7.target.rug.nl 7405 7480 computegonl computegonl freerk
application32.target.rug.nl 7505 7580 GoNL rwagner + pneerincx
vm7.target.rug.nl 7605 7680 chado rwagner
vm7.target.rug.nl - 11000 through 12000 Used for selenium tests jvelde
application32.target.rug.nl - 11000 through 12000 Reserved for selenium tests jvelde
vm7.target.rug.nl 4444 4888 Catalogue catalogue.war antonakd, chao
vm7.target.rug.nl 8009 6188 bbmri_catalogue bbmri.war antonakd

Start/Stop a Tomcat instance

For startup and shutdown of the tomcat instance use

prompt> /path/to/myinstance/bin/startup.sh
prompt> /path/to/myinstance/bin/shutdown.sh

Deploy an application

Place your myapplication.war file in /path/to/myinstance/webapps

In case the application is not correctly deployed delete the old context:

prompt> rm /path/to/myinstance/conf/Catalina/myengine/myapplication.xml
prompt> rm -r /path/to/myinstance/webapps/myapplication

Browse an application

Because your ports are blocked by the firewall there are two ways:

  • Login using ssh -X and use the firefox installation of the server (slow).
  • Let someone with sudo rights (Robert, Morris or Ger) add a so-called proxy pass to /etc/apache2/mods-available/proxy.conf and restart apache afterwards. (use /usr/sbin/apache2ctl restart) This directs traffic from a nice, non-blocked URL (port 80) like  http://vm7.target.rug.nl/animaldb to the real one on  http://vm7.target.rug.nl:5180/gcc.
    ProxyPass        /animaldb             http://vm7.target.rug.nl:5180/gcc
    ProxyPassReverse /animaldb             http://vm7.target.rug.nl:5180/gcc
    

Tips and Tricks

  • It is tricky to redirect a root URL to a non-root URL. Example:  http://www.col7a1.org/ ->  http://vm7.target.rug.nl:8080/col7a1/
    • Solution: If you have only one application running in your tomcat instance, deploy it under the root URL. To do that rename your .war file to ROOT.war. Afterwards it will be deployed under the root URL.
  • If you need to get the correct server name using the servlet API (getServletURL()), you have to add the proxy name to your configuration. Example: <Connector proxyName="www.col7a1.org" proxyPort="80" .../>