Installing Oracle ORDS with Apache Tomcat (Step-by-Step) Setting up Oracle REST Data Services (ORDS 22.1) with tomcat9

Setting up Oracle REST Data Services (ORDS) with Apache Tomcat is a crucial step if you want to run Oracle APEX in a modern web environment. This guide walks you through a clean installation, configuration, and deployment process on Oracle Linux.


🔧 Step 1: Prepare Environment (Root User)

Switch to root user and clean previous ORDS installation:

cd /root
cd /opt/oracle

# Remove old ORDS (if exists)
rm -rf ords

# Create fresh directory
mkdir -p /opt/oracle/ords

# Install unzip if not installed
yum install -y unzip

# Extract ORDS package
unzip ords-22.1.0.105.1723-COMPATIBLE-FOR-APEX_23.1.zip -d /opt/oracle/ords

# Move into ORDS directory
cd /opt/oracle/ords

# Create config directory
mkdir config

⚙️ Step 2: Set Proper Ownership & Permissions

Make sure Oracle user has full control:

chown -R oracle:oinstall /usr/local/tomcat
chown -R oracle:oinstall /opt/oracle/ords
chown -R oracle:oinstall /opt/oracle/ords/config

chmod -R 750 /opt/oracle/ords

🧑‍💻 Step 3: Switch to Oracle User & Install ORDS

su - oracle

cd /opt/oracle/ords

# Optional: Clean uninstall (if previously installed)
java -jar ords.war uninstall

# Install ORDS
java -jar ords.war --config /opt/oracle/ords/config install

⚠️ Important:

  • When prompted, use:
    • Service Name: XEPDB1 (for Oracle XE)
  • Provide correct SYS / SYSTEM credentials

🚀 Step 4: Deploy ORDS to Apache Tomcat

cp -a /opt/oracle/ords/ords.war /usr/local/tomcat/webapps/

🎨 Step 5: Configure APEX Static Images

APEX requires static files (CSS, JS, images) to render properly.

cd /usr/local/tomcat/webapps

# Create images directory
mkdir i

# Copy APEX images
cp -a /opt/oracle/apex/images/. /usr/local/tomcat/webapps/i/

🔗 Step 6: Configure Tomcat (server.xml)

Edit Tomcat configuration:

cd /usr/local/tomcat/conf
vi server.xml

Find this section:

<Host name="localhost" appBase="webapps"
      unpackWARs="true" autoDeploy="true">

Add the following line inside <Host>:

<Context docBase="/opt/oracle/apex/images/" path="/i/" />

This ensures APEX static resources are served correctly.


🔄 Step 7: Restart Apache Tomcat

cd /usr/local/tomcat/bin

./shutdown.sh
./startup.sh

✅ Final Check

Open your browser:

http://your-server-ip:8080/ords

If everything is configured correctly, Oracle APEX should load successfully.


💡 Pro Tips

  • Always ensure database is OPEN
  • Verify listener and service name:

    SELECT name FROM v$services;
  • Check logs if errors occur:
    • ORDS logs: /opt/oracle/ords/config/logs
    • Tomcat logs: /usr/local/tomcat/logs

🎯 Conclusion

You now have a fully working ORDS + APEX environment using Apache Tomcat. This setup is production-ready with further enhancements like:

  • SSL (HTTPS)
  • Domain mapping
  • Reverse proxy (Nginx)

RAW source code:-

vi ~/.bash_profile

export JAVA_OPTS="-Dconfig.url=/opt/oracle/ords/config -Xms512M -Xmx1024M"

source ~/.bash_profile

cd /usr/local/tomcat/bin

./shutdown.sh 
./startup.sh

---------------------------- start installation

go to root user :
-----------------

cd /root

cd /opt/oracle

--- remove the ords folder.

rm -rf ords

mkdir -p /opt/oracle/ords

cd /root

yum install unzip

unzip ords-22.1.0.105.1723-COMPATIBLE-FOR-APEX_23.1.zip -d /opt/oracle/ords

cd /opt/oracle/ords

mkdir config


******* specify XEPDB1 for the service name

chown -R oracle:oinstall /usr/local/tomcat

chown -R oracle:oinstall /opt/oracle/ords

chown -R oracle:oinstall /opt/oracle/ords/config

chmod -R 750 /opt/oracle/ords

-------------------------------------------------------------
-- go to oracle user

cd /opt/oracle/ords

java -jar ords.war uninstall

java -jar ords.war --config /opt/oracle/ords/config install

cp -a /opt/oracle/ords/ords.war /usr/local/tomcat/webapps/

---Then we need to copy APEX static files (images, stylesheets, JS files and so on) to the web server directory:

cd /usr/local/tomcat/webapps

mkdir i

cp -a /opt/oracle/apex/images/. /usr/local/tomcat/webapps/i/

cd /usr/local/tomcat/conf

vi server.xml

--- Now search for :  
<Host name="localhost"  appBase="webapps"
  unpackWARs="true" autoDeploy="true">

Add this line here :

<Context docBase="/opt/oracle/apex/images/" path="/i/" />

cd /usr/local/tomcat/bin

./shutdown.sh 
./startup.sh






Muhammad Abdullah Al Noor

Muhammad Abdullah Al Noor, An Oracle Apex Consultants and founder of Noors Technology (www.noorstech.com). Core Expertise : Database Administration, Oracle Forms and Reports Development, Oracle Apex Application Designer and Development, Linux Professional etc. Also the owner of TrainerBD Training and OraDemy E-Learning. WhatsApp +8801790721177

Post a Comment

Previous Post Next Post