Skip to content

Running apache tomcat

Tomasz Grabiec edited this page Nov 4, 2013 · 10 revisions

Prepare the deployment

If you already have one you can skip this step.

Install inside the guest image

You need to put the package under /usr/tomcat in the guest file system. For development you can leverage make process to do so:

  • Append the following line to usr.manifest replacing /home/tgrabiec/bin/ with the directory in which your tomcat is located in the host:
/usr/tomcat/**:/home/tgrabiec/bin/apache-tomcat-7.0.42/**
  • run make. On incremental build you will need to remove build/release/usr.img.d before or it will complain about inability to build dependencies.

If you already have the image, you can start OSv and use scp to copy the package.

Start OSv with tomcat

Save the following script as tomcat-cmd-line.sh. It will be used to build the command line for starting tomcat.

#!/usr/bin/env bash
CATALINA_BASE=/usr/tomcat

CATALINA_HOME=$CATALINA_BASE
CLASSPATH=$CATALINA_HOME/bin/bootstrap.jar

# Logging
LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"
LOGGING_MANAGER="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
CLASSPATH=$CLASSPATH:$CATALINA_HOME/bin/tomcat-juli.jar

CATALINA_TMPDIR=$CATALINA_BASE/temp

echo "java.so -cp $CLASSPATH \
       $LOGGING_CONFIG \
       $LOGGING_MANAGER \
       $JAVA_OPTS \
       $CATALINA_OPTS \
       -Dcatalina.base=$CATALINA_BASE \
       -Dcatalina.home=$CATALINA_HOME \
       -Djava.io.tmpdir=$CATALINA_TMPDIR \
       org.apache.catalina.startup.Bootstrap start"

You can now start OSv:

scripts/run.py -nv -e "`./tomcat-cmd-line.sh`"
Clone this wiki locally