Tomcat Upgrade on Plesk for Linux/Unix

This article describes how to upgrade Tomcat running under Plesk and how to disconnect the control Plesk has over the Tomcat server. This may not be the ideal configuration for you if you have many clients using JSP webapps. Your clients will no longer have the ability to use the Plesk war upload feature from the Plesk admin page.

Upgrade Java
If you plan to install the latest version of Tomcat on your server, you may need to upgrade to the latest version of Java as well. Many Plesk installations use Tomcat 4 and Java 1.4, so you may want Tomcat 5 + Java 5 or Tomcat 6 Java 6.

There are several ways to upgrade Java, and this article will give a simple outline without details.

You can download the latest Java JDK at this link. Note, you will need the stand alone JDK (java development kit) not with Netbeans, and not the JRE version.

Once you download the version for your platform, install the JDK. On Plesk 7.5, the current JVM is installed at /usr/lib/jvm The RPM install may install to this location. If you downloaded a tar package, you should move the expanded folder to this location.

You will need to download and build the .so file and add this to your /etc/httpd/conf/htpd.conf file for Apache to include. Details of this process are not covered here, but should be a Google search away.
Also, you will most likely need to add a text file /etc/httpd/conf/workers.properties

For each virtual host, you will need to give Apache several mod_jk configuration directives as listed here This step is covered at the end of this article.

Modify Tomcat's Startup Script /bin/catalina.sh

You can set the JAVA_HOME and CATALINA_HOME as environment variables if you like. Otherwise, you can set them directly in the catalina.sh file for Tomcat to pick up.
Of course you need to set these values to the version and the path that you used for both Java and Tomcat.

Create a directory /home/httpd/vhosts/mydomain.com/webapps/ for each virtual host's webapp.

Change ownership of this directory so that Tomcat can work with the files chown tomcat5:tomcat5 /home/httpd/vhosts/mydomain.com/webapps/

And finally, for each virtual host that you define, you will need to modify the vhost.conf file to have Apache play nice with Tomcat. This step gives Apache the mod_jk configuration directives for your virtual host.

Restart Tomcat
You should now be ready to restart Apache and Tomcat

/etc/init.d/httpd restart
/etc/init.d/tomcat5 restart

Try connecting to one of your virtual hosts, and if this does not work, try using port 8080 http://www.mydomain.com:8080/ If port 8080 is working, there is a problem with Apache talking to Tomcat and you will need to check your mod_jk settings.

If all is working, try restarting your server to make sure the startup script works and Tomcat runs on startup. Nobody likes webserver downtime!

Some things to consider
This upgrade does break the Plesk / Tomcat relationship. If you have customers with their own domains, you may want to take additional steps such as defining the security policy for Tomcat, automating the addition of virtual hosts to server.xml, and exposing the Tomcat manager to each virtual host client so they can deploy .war files on their own.