For the complete documentation index, see llms.txt. This page is also available as Markdown.

Externalize Oasis Properties for Tomcat in Linux

This article outlines the procedure for externalizing Oasis configuration properties in a Linux environment. The goal is to move critical configurations outside the application’s packaged directory, allowing for easier management, environment-specific overrides, and improved maintainability. The steps include setting up an external configuration directory, modifying the oasis.properties file, and configuring Tomcat to recognize these externalized properties using a custom setenv.sh script.

Prerequisites

  • Tomcat is installed and located under /home/ovaledge/apache-tomcat-10.1.40

  • The application (Oasis) is deployed and functional

  • The user has sudo/root access or sufficient permissions to modify files and restart Tomcat

  • JAVA_HOME is set and correctly configured

Configuration Steps

  1. Create extprop Directory

    • Create an external properties directory inside the ovaledge home folder:

      mkdir -p /home/ovaledge/extprop
    • Copy the oasis.properties file from the deployed application into this directory:

      cp /home/ovaledge/apache-tomcat-10.1.40/webapps/ovaledge/WEB-INF/classes/oasis.properties /home/ovaledge/extprop/

      Reference Screenshot 01:

      Reference Screenshot 02:

      Result: External properties directory /home/ovaledge/extprop is created and contains the oasis.properties file.

  2. Edit oasis.properties

    • Open the file with a text editor:

      vi /home/ovaledge/extprop/oasis.properties
    • Update the following configurations:

      • MySQL Connection Settings Verify hostname, port, username, and password

      • Elasticsearch Configuration Set the appropriate cluster name and host

      • Third-party JAR References Specify required external JAR paths if applicable

      ⚠️ Ensure sensitive values (like passwords or keys) are encrypted if required.

      Result: The oasis.properties file is updated with environment-specific values.

  3. Create setenv.sh in Tomcat

    • Navigate to the Tomcat bin directory:

      cd /home/ovaledge/apache-tomcat-10.1.40/bin
    • Create or edit the setenv.sh file:

      vi setenv.sh
    • Add the following content:

      export CATALINA_OPTS="\
      -Duse.http=true \
      -DOVALEDGE_SECURITY_TYPE=db \
      -DOVALEDGE_ENCRYPT_DECRYPT_KEY=ovaledge2021 \
      -Dext.properties.dir=file:/home/ovaledge/extprop/ \
      -Dlog4j.configuration=file:/home/ovaledge/extprop/log4j.properties \
      -Xms4g -Xmx8g \
      --add-opens java.base/jdk.internal.loader=ALL-UNNAMED \
      --add-opens jdk.zipfs/jdk.nio.zipfs=ALL-UNNAMED \
      --add-opens java.base/java.net=ALL-UNNAMED \
      --add-opens java.base/java.time=ALL-UNNAMED \
      --add-opens=java.base/java.nio=ALL-UNNAMED"

      Ensure the file is executable:

      chmod +x setenv.sh

      Result: Tomcat is configured to load external properties and custom memory settings during startup.

  4. Restart Tomcat Service

    • Restart Tomcat to apply the changes:

      cd /home/ovaledge/apache-tomcat-10.1.40/bin
      ./shutdown.sh
      ./startup.sh

      Result: Tomcat starts using the externalized oasis.properties and log4j.properties.

Validation

  • Check Tomcat logs: /home/ovaledge/apache-tomcat-10.1.40/logs/catalina.out

  • Ensure no FileNotFoundException for oasis.properties or log4j.properties

  • Validate application behavior (database connection, Elasticsearch integration)

Rollback Instructions

To rollback to default (packaged) configurations:

  • Remove or rename setenv.sh:

  • Restart Tomcat:

    ⚠️ This will cause the application to revert to internal property files packaged inside the WAR.


Copyright © 2025, OvalEdge LLC, Peachtree Corners, GA, USA.

Was this helpful?