Configure A Tomcat Instance to Use A Specific Version of the JDK

Configure A Tomcat Instance to Use A Specific Version of the JDK

Configure A Tomcat Instance to Use A Specific Version of the JDK

Objectives

  1. Configure a Tomcat instance to use a specific version of the JDK.

Prerequisites

  1. Administrative privileges on the tomcat server that you would like to change.

Instructions

    1. Log into the tomcat server via ssh.

    2. Find the directory that contains the version of the JDK that you would like to use:

        # ls -C1 /usr/java
        # JDK_DIRECTORY="/usr/java/jdk1.7.0_79"

        # echo ${JDK_DIRECTORY}

    3. Find the directory for the Tomcat instance that you would like to use a specific version of the JDK:

        # ls -C1 /srv/tomcat/instances
        # TOMCAT_INSTANCE="/srv/tomcat/instances/POSWebApplication"
        # echo ${TOMCAT_INSTANCE}

    4. Find the name of the service for the Tomcat instance:

        # SERVICE_NAME="$(basename ${TOMCAT_INSTANCE})"
        # echo ${SERVICE_NAME}

    5. As the "root" user, edit the script that sets environment variables for this Tomcat instance:

        # vi ${TOMCAT_INSTANCE}/bin/setenv.sh

    6. Uncomment the line that sets that JAVA_HOME variable:

        :%s/#readonly JAVA_HOME="";/readonly JAVA_HOME="";/g

    7. Set JAVA_HOME variable to the full path to the directory from step #2.

        :%s/readonly JAVA_HOME="";/readonly JAVA_HOME="/usr/java/jdk1.7.0_79";/g

    8. Save your changes and quit:

        :wq

    9. Restart the Tomcat instance:

        # service ${SERVICE_NAME} restart

    10. Confirm that the Tomcat instance is using the correct version of the JDK:

        # grep -h 'JVM Version:' ${TOMCAT_INSTANCE}/logs/catalina.log | tail -1

   11. Send an email with output from the following commands to the Systems team:

        # echo "Hostname:                     ${HOSTNAME}"
        # echo "JDK directory:              ${JDK_DIRECTORY}"
        # echo "Tomcat instance:           ${TOMCAT_INSTANCE}"
        # echo "Tomcat service name:   ${SERVICE_NAME}"

 


    • Related Articles

    • Configure A Tomcat Instance to Use A Specific Version of Tomcat

      Configure A Tomcat Instance to Use A Specific Version of Tomcat Objectives 1. Configure a Tomcat instance to use a specific version of Tomcat. Prerequisites 1. Administrative privileges on the tomcat server that you would like to change. Instructions ...
    • Prometheus (Grafana) Metrics Tomcat Configuration

      FullCount's Tomcat application servers are configured to export certain JMX MBean values to a metrics file. The metrics in this file are then collected by Prometheus and displayed in dashboards through Grafana. To configure this monitoring, two files ...
    • How To Use Magic Wand on OS Image Version 7.5.0+

      How To Use Magic Wand on OS Image Version 7.5.0+ Objectives Update FullCount OS Images to newer versions via Magic Wand. Prerequisites 1. FullCount Device with OS Image 7.5.0+ 2. A new update available 3. Device Management configured to Allow OS ...
    • Quick Start Use nmtui to Configure Network Interfaces on OS Image 7.3.1+

      Quick Start Use nmtui to Configure Network Interfaces on OS Image 7.3.1+ Objectives Use Network Manager's text user interface to configure network interfaces. Prerequisites Device Keyboard Networking information Instructions 1. Switch to shell by ...
    • Cheatsheet for Terminal OS Image Version 5.0 and Newer

      Task Instructions Why am I doing this? Local Remote Switch to Shell: Connect USB keyboard to terminal. Press Control + Alt + F1. At the login: prompt, type root and press Enter. At the Password: prompt, type #FullCount#Support# and press Enter. ...