welcome hpws docs hp-ux webservers home contact hp support
hp logo - invent  hp-ux web server suite

Migration Guide for HP-UX Tomcat-based Servlet Engine

TABLE OF CONTENTS

Objective Migration from HP Tomcat 4.1.29 Will it be difficult ? Runtime Dependencies Debugging and Error Logging Legal Notices

OBJECTIVE

This migration guide will aid you in migrating your applications from HP-UX Tomcat 4.1.29 to (Tomcat 5.5.23). Additionally we will discuss some configuration changes that need to be made when migrating from HP-UX Tomcat version 4.1.29.x to HP-UX Tomcat-based Servlet Engine (Tomcat 5.5.23). This guide however, does not cover issues related to different servlet specifications. Tomcat 5.5.x implements Servlet 2.4 and JSP 2.0 specifications, whereas Tomcat 4.x implement Servlet 2.3 and JSP 1.2 specs. For differences on these specs see http://www.javaworld.com/javaworld/jw-03-2003/jw-0328-servlet.html Full Servlet specification can be found at http://java.sun.com/products/servlet and JSP at http://java.sun.com/products/jsp.

MIGRATION FROM HP TOMCAT 4.1.29

Will it be difficult ? If you have maintained a clean, specification-compliant webapp, your upgrade may be as simple as "rebuild" and "adjust the config files". 1.1 Tomcat 5 implements newer versions of the servlet and JSP specs Rebuild your application using JDK 1.4.x, if you're not already using it. The newer JDK is a Tomcat 5 requirement. Be sure to check for deprecated methods. As Tomcat 5 implements newer versions of the servlet and JSP specifications, you must rebuild your applications against the newer JAR files provided with Tomcat 5. Also check for deprecations as some interfaces and methods have been deprecated. Please note that the servlet and jsp api jar files are renamed as servlet-api.jar and jsp-api.jar. For compiling with newer jar files, do the following: In your build $CLASSPATH, replace any references to /opt/hpws/tomcat/common/lib/servlet.jar /opt/hpws/tomcat/common/lib/jsp.jar with /opt/hpws/tomcat/common/lib/servlet-api.jar /opt/hpws/tomcat/common/lib/jsp-api.jar Note: There have been some changes to the servlet specification between 2.3 and 2.4; for example, SingleThreadModel has been deprecated. Review the specification to make sure you don't have to make any code-level changes. 1.2 Changes in the Configuration files The <Connector> element in server.xml has changed. Tomcat 4: <Connector className="org.apache.catalina.connector.http.HttpConnector" port="{tomcat port}" minProcessors="2" maxProcessors="5" enableLookups="true" address="{tomcat IP}" /> Tomcat 5: <Connector protocol="HTTP/1.1" port="{tomcat port}" address="{tomcat IP}" enableLookups="false" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" acceptCount="100" debug="0" connectionTimeout="-1" disableUploadTimeout="true" /> Note that the "className" attribute is not required, specifying protocol="HTTP/1.1" indicates that the HTTP connector is to be used. NOTE: The JK2/Coyote Connector used for connecting to mod_jk2 is no more valid in Tomcat 5.5.x. Its functionality is incorporated into AJP 1.3 connector. When using mod_jk2, you need to specify which jk2 properties file to use by Tomcat. For this use "propertiesFile" attribute as shown below in the AJP 1.3 connector element. <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" propertiesFile="conf/jk2.properties" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /> The Serverwide web.xml and catalina.policy have changed. If you use the single Tomcat install (all of your webapps are under the Tomcat install directory), your webapp will pick this up automatically. If, instead, you use multiple Tomcat instances ($CATALINA_BASE vs $CATALINA_HOME), you must copy the new file to $CATALINA_BASE/conf. 1.3 Compile JSP Using Eclipse JDT HP-UX Tomcat 5.5 uses the Eclipse JDT Java compiler for compiling JSP pages. This means you no longer need to have the complete Java Development Kit (JDK) to run Tomcat, but a Java Runtime Environment (JRE) is sufficient. The Eclipse JDT Java compiler is bundled with the HP-UX Tomcat engine. Tomcat can also be configured to use the compiler from the JDK to compile JSPs, or any other Java compiler supported by Apache Ant. 1.4 All Classes needs to be packaged If your app uses packageless classes -- that is, you use bare ClassName and not some.package.ClassName -- you must package them. This is required by the servletspec 2.4, and Tomcat enforces it. 1.5 JARs not included with this version The JavaMail JARs -- such as activation.jar and mail.jar -- are no longer included with Tomcat. Depending on your needs you can download them from Sun or simply copy them to from your old Tomcat install, into /opt/hpws/tomcat/common/lib. 1.6 Use of context.xml for context-specific settings It is encouraged that context-specific settings be placed in context.xml and not in the serverwide server.xml. The context.xml contains a raw <Context> element. It permits you to change per-webapp settings without disturbing the global server.xml file. For more information on how to make context level settings please visit: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html 1.7 New XML parser Tomcat 5 includes a newer, pickier XML parser (Xerces 2.6.0). If you suddenly encounter problems parsing XML, this is the place to look. 1.8 JSP 2.0's new rule for jsp:useBean usage JSP spec 2.0 adds a rule that may conflict with your use of <jsp:useBean>: if the specified object is not found in the specified context, containers may throw an exception or attempt to create the object using the default (no-args) constructor. If the object doesn't have a no-args constructor, problems will ensue. Tomcat will fail to compile the page, because it cannot instantiate the object. (Refer to Tomcat Bugzilla ID 26444)

RUNTIME DEPENDENCIES

HP-UX Tomcat-based Servlet Engine 5.5.9 is designed to run on JDK 1.5, but it still runs on JDK 1.4 with a compatibility package installed. This compatibility package is bundled along with HP-UX Tomcat, so it would work even with your older JVMs. However it is recommended to run using latest JDK 1.5. The latest version of Java can be downloaded from http://www.hp.com/go/java. To find out your version enter: $ java -version You will see something like: 1) on PA machine: java version "1.5.0.01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0.01-_17_may_2005_17_33) Java HotSpot(TM) Server VM (build 1.5.0 FCS (JS B64) jinteg:05.17.05-16:53 PA2.0 (aCC_AP), mixed mode) 2) on IPF machine: java version "1.5.0.01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0.01-_17_may_2005_17_33) Java HotSpot(TM) Server VM (build 1.5.0 FCS (JS B64) jinteg:05.17.05-16:53 IA64, mixed mode)

DEBUGGING AND ERROR LOGGING

The <Logger> element is no more a valid element in server.xml. Tomcat 5.5 uses Commons Logging Log throughout its internal code for logging purposes. Commons Logging provides tomcat the ability to log hierarchially across various log levels without needing to rely on a particular logging implementation. For more information on Commons Logging and its configuration, Please refer to: http://jakarta.apache.org/commons/logging/index.html Tomcat 5.5 comes with a default logging implementation called JULI. For more information on configuration of JULI see, http://jakarta.apache.org/tomcat/tomcat-5.5-doc/logging.html 1) Logging server start and stop By default, output from standard error and output are stored in /opt/hpws/tomcat/logs/catalina.out file. You can examine it if you are having problems starting/stopping HP-UX Tomcat-based Servlet Engine. ***************************************************************************