Tomcat on AS400 (aka i-series, Systemi, IBM i, bla, bla…)
I know that AS400 gives its own native support to Tomcat and other application servers, but it does it in the IBM style: intricate and rigid. What if, for example, I need to use a version of Tomcat that it is not shipped with my operating system?
Here is one possible answer:
1) Download a copy of Apache Tomcat and unzip it in a directory of the Integrated File System of AS400.
2) In another directory of the Integrated File System Create a text file named tomcat with a simple script like this:
#! /bin/sh
#The path of the JDK you want to use
export JAVA_HOME=/QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit
#The JVM option you want to use
export JAVA_OPTS='-Djava.awt.headless=true'
#Put here the pat of the tomcat directory
export CATALINA_HOME=/path/to/tomcat/directory
export PATH=$CATALINA_HOME/bin:$PATH
if [ "$1" == "stop" ] ; then
echo "Stopping..."
shutdown.sh
else
echo "Starting..."
startup.sh
fi
3) In a 5250 session (or in a batch job) execute this command
QSH CMD('/path/to/my/script/tomcat')
Your Tomcat should be alive and kicking
4) In order to shut down Tomcat, use this command
QSH CMD('/path/to/my/script/tomcat stop')
Enjoy with Tomcat and AS400!!!
