Skip to main content

Apache Tomcat

info

Please refer to the Proposed Directory Structure for assistance with the steps below.

Basic Configuration

  1. Open the launcher.cfg file which is located in the top-level directory of the Java Launcher Pack.

  2. Search for the following lines:

    #CONTAINER_HOME=<absolute-path>
    #JVM_HOME=<absolute-path>
    #WARATEK_HOME=<absolute-path>

    Relative paths are supported in the JLP configuration file. The paths are resolved relative to the location of the launcher.cfg file that they are defined in.

  3. Delete the # symbol at the beginning of each line to enable settings.

  4. Set CONTAINER_HOME to the location of JDK which your existing Application is using (e.g. Oracle Hotspot version 6u23).

  5. Set JVM_HOME to the location of host JDK which is typically the latest version at the time of the Waratek installation (e.g. Oracle Hotspot version 8u191).

  6. Set WARATEK_HOME to the location of the Waratek agent:

    • On Linux:
      WARATEK_HOME=/opt/waratek/agent
    • On Windows:
      WARATEK_HOME=<path-to-waratek-software>\agent
  7. Set JAVA_HOME to the location where the Java Launcher Pack is installed:

    • On Windows: Locate the setenv.bat (usually in the bin/ folder of Tomcat), add the following line:
      JAVA_HOME=<path-to-waratek-software>\launcher
    • On Linux: Locate the setenv.sh (usually in the bin/ folder of Tomcat), add the following line:
      JAVA_HOME=/opt/waratek/launcher
  8. Set WARATEK_PROPERTIES:

    • It is recommended that this is set via a command-line argument.
    • The property file can use any name.
    • If using the Waratek Proposed Directory Structure on Linux, add the following line to setenv.sh:
      JAVA_OPTS="$JAVA_OPTS -Dcom.waratek.WaratekProperties=/opt/waratek/conf_*/<name of property file>"
    • If using the Waratek Proposed Directory Structure on Windows, add the following line to setenv.bat:
      set JAVA_OPTS=%JAVA_OPTS% -Dcom.waratek.WaratekProperties=<absolute-path-to-waratek-software>\conf_*\<name of property file>
  9. Start the application and verify Waratek has been installed correctly by checking server logs or noting the Waratek logo on the terminal:

                       __      __
    _ _____ ________ _/ /____ / /__ Waratek Application Security Technologies
    | |/|/ / _ `/ __/ _ `/ __/ -_) '_/ Copyright 2018 / All Rights Reserved
    |__,__/\_,_/_/ \_,_/\__/\__/_/\_\ www.waratek.com / @waratek

Apache Tomcat as a Windows Service

  1. Go to <absolute-path-to-tomcat>\bin.
  2. Open the Tomcat<version_number>w.exe file.
  3. In the Monitor Tomcat GUI, check that the Service Status is Stopped.
  4. Go to the Java tab.
  5. In the Java Virtual Machine field, add the path to the host JVM as follows:
    • For JVM Mode:
      <absolute-path-to-host-jdk>\jre\bin\server\jvm.dll
    • For Java Mode:
      <absolute-path-to-host-jdk>\bin\java
      or
      <absolute-path-to-host-jdk>\jre\bin\java
  6. In the Java Options field add:
    -agentpath:<absolute-path-to-waratek-software>\agent\<path\to>\waratek.dll
    -javaagent:<absolute-path-to-waratek-software>\agent\waratek.jar
    -Dcom.waratek.WaratekProperties=<absolute-path-to-waratek-software>\<config directory>\waratek.properties

    Note: The -Dcom.waratek.WaratekProperties entry is required to specify the path to your Waratek properties file.

  7. When using JVM Mode, the following two arguments must be included in the Java Options field:
    -Dsun.java.command=org.apache.catalina.startup.Bootstrap
    -Dcom.waratek.jnimode=true
    Notes:
    • Leave any existing Java options unmodified (e.g. -Dcatalina.home, -Dcatalina.base, -Djava.endorsed.dirs, -Djava.io.tmpdir, -Djava.util.logging.manager, -Djava.util.logging.config.file).
    • If using a Java 11 host JDK with Tomcat running as a service (without the Java Launcher Pack), the following Java Option should also be added to the Java Options field:
      --patch-module=java.base=<absolute-path-to-waratek-software>\agent\<path\to>\module_patch.jar
  8. Set CONTAINER_HOME to the guest JDK in the properties file pointed to by -Dcom.waratek.WaratekProperties:
    com.waratek.ContainerHome=<absolute-path-to-guest-jdk>

    Important: When specifying Windows file paths in the properties file, you must escape file separators. For example: com.waratek.ContainerHome=C:\\top_dir\\another_dir\\java_dir

  9. Go to the Startup tab and the Shutdown tab.
  10. Ensure the Mode at the bottom is set to the appropriate value.
  11. Click Apply.
  12. Go to the General tab, start the Tomcat service to have the changes take effect.