# 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:

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

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

     \
     *Reference Screenshot 01:*

     <figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcGqW5T00zy18qJWGbd6j79f4AFWEVTgOhyvvjBK4mNu0uMXcKoVdZzPa8XlDkmujkRUSPmNY4h6LP1dqsObXy1WJ5iqoxesPI37QdzTc_DzGG11NucFuOapWZf7JWN8A9FRJjy2A?key=SDCZEuhCirWgGdwP9b5AFw" alt=""><figcaption></figcaption></figure>

     \
     \&#xNAN;*Reference Screenshot 02:*

     <figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfkEfc4SQa_ihB0WzN1ln66s44EFl_Xn4GKgRcSsUtKKPYfOEokFiFvy2DSFk7_g8zWbGEAERclWgFFyDPN-DUvD3IqxkHIG2OD5WE6I-4rO91ovjwT9oIEntFQ_wjPETJfG_kOjw?key=SDCZEuhCirWgGdwP9b5AFw" alt=""><figcaption></figcaption></figure>

     ✅ **Result:** External properties directory `/home/ovaledge/extprop` is created and contains the `oasis.properties` file.<br>
2. Edit oasis.properties
   * Open the file with a text editor:

     ```bash
     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.<br>

     ✅ **Result:** The `oasis.properties` file is updated with environment-specific values.<br>
3. Create setenv.sh in Tomcat
   * Navigate to the Tomcat `bin` directory:

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

     ```bash
     vi setenv.sh
     ```
   * Add the following content:

     ```bash
     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:

     ```bash
     chmod +x setenv.sh
     ```

     \
     ✅ **Result:** Tomcat is configured to load external properties and custom memory settings during startup.<br>
4. Restart Tomcat Service
   * Restart Tomcat to apply the changes:

     ```bash
     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`:

  ```bash
  mv setenv.sh setenv.sh.bak
  ```
* Restart Tomcat:

  ```bash
  ./shutdown.sh && ./startup.sh
  ```

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

***

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ovaledge.com/release8.1/deployment-and-maintenance/configuration/externalize-oasis-properties-for-tomcat-in-linux.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
