Running Tomcat on OpenVMS

HP offers an Apache based web server named "Secure Web Server" (SWS). It includes an Apache module CSWS_JAVA (Tomcat). The current version of this module is CSWS_JAVA Version 7.0-29 for OpenVMS Integrity Server (based on Apache Tomcat 7.0.29).

At the time of writing, it is unknown to me whether HP plans to create newer versions of Tomcat for SWS.

These notes show how to install and run Tomcat on OpenVMS, independent of HP's Secure Web Server.

I hope these notes are of use to someone out there.

THE ENVIRONMENT

OpenVMS for Integrity Servers Version 8.3 is the minimum version for which this should work. Newer versions are recommended, as there are 8.3-1H1 or 8.4 from HP or 8.4-1H1 from VSI.

Java 6 (at the time of writing there is no newer Java version available from HP or VSI), the HP kit is named J2SE™ Development Kit (JDK) 6.0-4, which is based on Java SE 6 Update 37.

Patches, aka ECOs, for OpenVMS as listed in http://h18012.www1.hp.com/java/download/ivms/1.6.0/jdk6.0_patches.html.

Some disk space (~20MB is the minimum for the installation) on an ODS5 disk.

A recent archive tool for zip archives or compressed tar files.

Scripts, aka VMS DCL command procedures, as shown below.

THE INSTALLATION

Ensure that Java 6 is installed on OpenVMS and that at least all the ECOs as described above are installed. It is recommended to have the operating system patched to the current level. At least the C-run-time environment should have the current patch level.

Step 1: Download Tomcat

Download Tomcat from the Tomcat home page, and get the binary version, either the zip or tar.gz file. I downloaded apache-tomcat-7.0.64.tar.gz.

Step 2: Extract Tomcat archive

Extract the files into a directory on an ODS5 disk. Verify that your unzip or tar utility creates case sensitive file names. The result of extracting will be a sub-directory apache-tomcat-7.0.64, which from the VMS command line will be shown as apache-tomcat-7^.0^.64.DIR;1 (For convenience you can rename the directory file, to avoid the escape character '^', for example to apache-tomcat-7064.DIR;1.)

It is recommended to use the directory filename as is and to set the VMS process' parse style for commands to accept ODS5 file specifications: $ set process/parse_style=extended/case_lookup=blind.

It is also recommended to make the sub-directory files deletable: $ set protection=o:rwed [.apache-tomcat-7^.0^.64...]*.dir

Step 2: Add the OpenVMS specific scripts

Extract the scripts shown below into the appropriate directories.

Step 3: Test the installation

Run the version script: $ @[.apache-tomcat-7^.0^.64.bin]version. The result should look like:

Server version: Apache Tomcat/7.0.64
Server built:   Aug 19 2015 17:18:06 UTC
Server number:  7.0.64.0
OS Name:        OpenVMS
OS Version:     V8.4
Architecture:   ia64
JVM Version:    1.6.0-6
JVM Vendor:     Hewlett-Packard Company
$ 

Start Tomcat: @[.apache-tomcat-7^.0^.64.bin]startup.

The supplied startup script runs Tomcat in a spawned OpenVMS sub-process of your current interactive process. That is, there will be some asynchronous output shown in your terminal which is produced by VMS and/or Tomcat. However, you can enter any DCL command while Tomcat is running - including the command to stop it.

The output may look like:

%DCL-S-SPAWNED, process BECKER_39053 spawned
$ 
Oct 16, 2015 2:56:17 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version:        Apache Tomcat/7.0.64
Oct 16, 2015 2:56:17 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Aug 19 2015 17:18:06 UTC
Oct 16, 2015 2:56:17 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number:         7.0.64.0  
...
Oct 16, 2015 2:56:26 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8339 ms

Now open a browser window, and enter http://YOUR_VMS_NODE:8080 - the default Tomcat page should open.

Stop Tomcat: @[.apache-tomcat-7^.0^.64.bin]shutdown.

Similar to the startup script, the supplied shutdown script runs in a spawned OpenVMS sub-process. That is, there will be some asynchronous output shown in your terminal which is produced by VMS and/or Tomcat. However you can enter any DCL command while Tomcat is shutting down.

The output may look like:

%DCL-S-SPAWNED, process BECKER_18865 spawned
$ 
Oct 16, 2015 3:00:50 PM org.apache.catalina.core.StandardServer await
INFO: A valid shutdown command was received via the shutdown port. Stopping the Server instance.
...

Step 4: After the installation

Now you are ready to deploy your web application and configure Tomcat for your needs.

Whether you remove specific files, which are not required for OpenVMS is up to you as well as removing the default Tomcat web application.

OpenVMS SCRIPTS

Save this file as catalina.com into the bin directory of your installation.

Contents of the OpenVMS specific catalina server script

$! OpenVMS Control Script for the CATALINA Server
$! catalina.com, 8-Apr-2014, hb
$
$ default = f$environment("default")
$ this_file = f$environment("procedure")
$ on control_y then -
        $ goto common_exit
$ on error then -
        $ goto common_exit
$ set def 'f$parse(this_file,,,"device")''f$parse(this_file,,,"directory")'
$ set def [-]
$ set protection=(SYSTEM:RWED,OWNER:RWED,GROUP:RE,WORLD)/default
$ config_setup = f$search("[.bin]java$config_setup.com")
$ if config_setup .eqs. ""
$ then
$     write sys$output "%version-e-fnf, java$config_setup.com not found."
$     goto common_exit
$ endif
$ if f$trnlnm("JAVA$CANCEL_CURRENT") .nes. ""
$ then
$     ! just avoid the %SYSTEM-F-NOLOGNAM from @JAVA$CANCEL_CURRENT
$     deassign := deassign/nolog
$     @JAVA$CANCEL_CURRENT
$ endif
$ @sys$startup:java$60_setup
$ define := define/nolog
$ @'config_setup
$ LOGGING_CONFIG="""-Djava.util.logging.config.file=./conf/logging.properties"""
$ options=""
$ options= options +-
        """-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"" "
$ options= options +-
        """-Djava.util.logging.config.file=./conf/logging.properties"" "
$ libs="./bin/bootstrap.jar:" +-
        "./bin/tomcat-juli.jar"
$ define/job/nolog classpath "''libs'"
$ spawn/nowait/input=nl: java 'LOGGING_CONFIG 'options -
        "-Dcatalina.base=./" "-Dcatalina.home=./" -
        "-Djava.io.tmpdir=./temp" -
        "org.apache.catalina.startup.Bootstrap" 'p1'
$
$ common_exit:
$ set default 'default

Save this file as startup.com into the bin directory of your installation.

Contents of the OpenVMS specific startup script

$! OpenVMS Start Script for the CATALINA Server
$! startup.com, 17-Jun-2013, hb
$
$ this_file = f$environment("procedure")
$ parse = f$getjpi(0,"parse_style_perm")
$ case = f$getjpi(0,"case_lookup_perm")
$ on control_y then -
              $ goto common_exit
$ on error then -
              $ goto common_exit
$ set process/parse=extended/case=blind
$ @'f$parse(this_file,,,"device")''f$parse(this_file,,,"directory")'catalina "start"
$ common_exit:
$ set process/parse='parse/case='case

Save this file as shutdown.com into the bin directory of your installation.

Contents of the OpenVMS specific shutdown script

$! OpenVMS Stop Script for the CATALINA Server
$! shutdown.com, 17-Jun-2013, hb
$
$ this_file = f$environment("procedure")
$ parse = f$getjpi(0,"parse_style_perm")
$ case = f$getjpi(0,"case_lookup_perm")
$ on control_y then -
              $ goto common_exit
$ on error then -
              $ goto common_exit
$ set process/parse=extended/case=blind
$ @'f$parse(this_file,,,"device")''f$parse(this_file,,,"directory")'catalina "stop"
$ common_exit:
$ set process/parse='parse/case='case

Save this file as version.com into the bin directory of your installation.

Contents of the OpenVMS specific version script

$! OpenVMS Version Script for the CATALINA Server
$! version.com, 8-Apr-2014, hb
$
$ default = f$environment("default")
$ this_file = f$environment("procedure")
$ parse = f$getjpi(0,"parse_style_perm")
$ case = f$getjpi(0,"case_lookup_perm")
$ on control_y then -
        $ goto common_exit
$ on error then -
        $ goto common_exit
$ set process/parse=extended/case=blind
$ set def 'f$parse(this_file,,,"device")''f$parse(this_file,,,"directory")'
$ set def [-]
$ config_setup = f$search("[.bin]java$config_setup.com")
$ if config_setup .eqs. ""
$ then
$     write sys$output "%version-e-fnf, java$config_setup.com not found."
$     goto common_exit
$ endif
$ if f$trnlnm("JAVA$CANCEL_CURRENT") .nes. ""
$ then
$     ! just avoid the %SYSTEM-F-NOLOGNAM from @JAVA$CANCEL_CURRENT
$     deassign := deassign/nolog
$     @JAVA$CANCEL_CURRENT
$ endif
$ @sys$startup:java$60_setup
$ define := define/nolog
$ @'config_setup
$ java -classpath ./lib/catalina.jar org.apache.catalina.util.ServerInfo
$ common_exit:
$ set default 'default
$ set process/parse='parse/case='case

Save this file as java$config_setup.com into the bin directory of your installation.

Contents of the OpenVMS specific Java setup script

$! JAVA$CONFIG_SETUP.COM
$!
$! --NOTE:
$! --       THIS FILE WAS ORIGINALLY GENERATED BY
$! --       SYS$COMMON:[JAVA$60.COM]JAVA$CONFIG_WIZARD.COM;1
$! --       ON  7-MAR-2013 14:41:12.27
$! --       IT HAS BEEN MANUALLY EDITTED SINCE THEN.
$! --
$! --       For more complete description of the logicals shown,
$! --       please read the release notes.
$!
$! The following are useful in all environments.
$!
$ SET PROCESS/PARSE_STYLE=EXTENDED
$ DEFINE/JOB DECC$ARGV_PARSE_STYLE TRUE
$ DEFINE/JOB DECC$EFS_CASE_PRESERVE TRUE
$ DEFINE/JOB JAVA$DAEMONIZE_MAIN_THREAD TRUE
$ DEFINE/JOB JAVA$DISABLE_CMDFILE_WHITESPACE_PARSING TRUE
$ DEFINE/JOB DECC$ENABLE_GETENV_CACHE TRUE
$ DEFINE/JOB DECC$FILE_PERMISSION_UNIX TRUE
$!
$! Omitting logicals useful in debugging environment.
$!
$! Omitting logicals useful in mimicing UNIX file system behavior
$!
$! Omitting logicals useful in heavy child processes { runtime.exec() } behavior
$!
$! Logicals useful for supporting file sharing:
$!
$ DEFINE/JOB DECC$FILE_SHARING TRUE  ! ask for C-RTL support for file sharing
$!
$! Omitting logicals useful for bypassing secondary stat() call.
$!
$! Logicals useful to set up caching of file/directory information
$!
$ DEFINE/JOB JAVA$CACHING_INTERVAL 60  ! to disable, undefine logical or set value to 0
$ DEFINE/JOB JAVA$CACHING_DIRECTORY TRUE ! enable special case -- don't look in directory if directory known to be absent
$!
$! Logicals useful for supporting ODS-5 operation only.
$! 
$! NOTE:
$!    The value of JAVA$FILENAME_CONTROLS generated below is different than the one set in JAVA$60_SETUP.COM
$!    To make this new value be in effect, be sure to run JAVA$CONFIG_SETUP.COM after you run JAVA$60_SETUP.COM.  
$ DEFINE/JOB DECC$EFS_CHARSET  TRUE  ! 
$ DEFINE/JOB DECC$EFS_CASE_SPECIAL  FALSE  ! 
$ DEFINE/JOB JAVA$FILENAME_CONTROLS 8 ! only enable the mixed UNIX/VMS filespec mapping
$ DEFINE/JOB JAVA$READDIR_CASE_DISABLE  TRUE  ! turns off auto. class/source case-sensitive name extraction
$!
$!    See: SYS$COMMON:[JAVA$60.COM]JAVA$FILENAME_CONTROLS.COM for explanation of bits enabled above.
$!
$! Omitting logicals useful supporting PC-style keyboard on workstation.
$!


CategoryFAQ

TomcatOnOpenVMS (last edited 2015-10-20 12:57:19 by HartmutBecker)