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.40The application (Oasis) is deployed and functional
The user has sudo/root access or sufficient permissions to modify files and restart Tomcat
JAVA_HOMEis set and correctly configured
Configuration Steps
Create extprop Directory
Create an external properties directory inside the ovaledge home folder:
mkdir -p /home/ovaledge/extpropCopy the
oasis.propertiesfile 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/extpropis created and contains theoasis.propertiesfile.
Edit oasis.properties
Open the file with a text editor:
vi /home/ovaledge/extprop/oasis.propertiesUpdate 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.propertiesfile is updated with environment-specific values.
Create setenv.sh in Tomcat
Navigate to the Tomcat
bindirectory:cd /home/ovaledge/apache-tomcat-10.1.40/binCreate or edit the
setenv.shfile:vi setenv.shAdd 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.
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.propertiesandlog4j.properties.
Validation
Check Tomcat logs:
/home/ovaledge/apache-tomcat-10.1.40/logs/catalina.outEnsure no
FileNotFoundExceptionforoasis.propertiesorlog4j.propertiesValidate application behavior (database connection, Elasticsearch integration)
Rollback Instructions
To rollback to default (packaged) configurations:
Remove or rename
setenv.sh:mv setenv.sh setenv.sh.bakRestart Tomcat:
./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.
Last updated
Was this helpful?

