9.15.2006

 

Two Tomcats, Two JREs

I had to set up two versions of Tomcat running on two separate JREs in order to test compatability for some code that was experiencing errors. Here are some quick steps to do this setup on Windows for Tomcat 5.0/JDK 1.4 and Tomcat 5.5/JDK 1.5:
  1. Download Java SDK 1.4.2_12 and install into C:\j2sdk1.4.2_12
  2. Download Java SDK 1.5.0_08 and install into C:\jdk1.5.0_08
  3. Download Tomcat 5.0.28 and install into C:\tomcat-5.0.28
  4. Download Tomcat 5.5.17 (the .zip, not the executable installer) and install into C:\tomcat-5.5.17
  5. Change the installations so that they do not both run HTTP on port 8080. In each installation's conf/server.xml, find the tag that says <connector port="8080"> and change it to a different port number. I changed them to 5028 and 5517 respectively, since those correspond to the Tomcat version numbers.
  6. Change the installations so that the servers themselves do not both run on port 8005. In each installation's conf/server.xml, find the tag that says <server port="8005"> and change one of them to a different port number. Since you won't ever typically refer to this port number anywhere, it doesn't have to be memorable. I changed one to 8006 and left the other as 8005.
  7. Create a startup script for each Tomcat, to set the appropriate environment variables and start the process. Here's my Tomcat 5.0 startup script; the 5.5 one is analogous, with each environment variable changed appropriately.

    set CATALINA_BASE=C:\tomcat-5.0.28
    set CATALINA_HOME=C:\tomcat-5.0.28
    set CATALINA_TEMP=C:\tomcat-5.0.28\temp
    set JAVA_HOME=C:\j2sdk1.4.2_12
    C:\tomcat-5.0.28\bin\catalina start

  8. Create a shutdown script for each Tomcat. These will be identical to the startup scripts, but with the "stop" option passed to catalina instead of "start."
  9. Run both startup scripts, then check http://localhost:5028 and http://localhost:5517 to make sure that each is running, and that each really is running on the proper version of Tomcat (check the version number displayed on the first screen.
Keep in mind that having two different JREs in active use can wreak havoc with Java-based applications. In particular, most will either check the system JAVA_HOME environment variable to see where Java lives, or else they'll have their own configuration for where to look. If you experience problems (particularly "unsupported major/minor version 49.0" or the like) I'd recommend checking to see what JRE the application is trying to use.

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?