Skip Navigation

Configure ORDS for Oracle APEX on Apache Tomcat

In the most basic configuration, the ORDS server will be started as a standalone server. But if you need to deploy the ORDS server using Apache Tomcat, please read below.
The steps to install APEX and start a standalone ORDS server is available in the below link

https://ttmatters.com/install-apex-ords-oracle-database

Once you have a working standalone ORDS setup, it can be integrated with Tomcat using the steps given below:

Create tomcat user

[root@linux ]# adduser tomcat
[root@linux ]# chown -R tomcat:tomcat /u01/app/ords
[root@linux ]# cd /u01/app/ords

              

Prepare ords.war and images

If you already have the ords.war and images, those can be reused with Tomcat. Otherwise prepare the ords.war and images files as suggested in the above linked guide

java -jar ords.war

Download and install Tomcat

Download Tomcat from here.
Create the tomcat directory and extract the downloaded file to this directory as tomcat user

[root@linux]# mkdir -p /u01/app/tomcat
[root@linux]# chown -R tomcat:tomcat /u01/app/tomcat/
[root@linux]# su tomcat
[tomcat@linux]$ cd /u01/app/tomcat/
## copy tomcat file to this directory
[tomcat@linux tomcat]$ tar zxvf apache-tomcat-9.0.16.tar.gz
              

Add these lines to tomcat user's .bash_profile file

CATALINA_HOME=/u01/app/tomcat/apache-tomcat-9.0.16
CATALINA_BASE=$CATALINA_HOME
export CATALINA_HOME
export CATALINA_BASE

Start up Tomcat web server

[tomcat@linux tomcat]$ /u01/app/tomcat/apache-tomcat-9.0.26/bin/startup.sh

Open the VM ports as well as the subnet ports on the Cloud console security lists or filrewall to allow connections to the port 8080

[root@linux tomcat]# iptables -I INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
[root@linux tomcat]# service iptables save
[root@linux tomcat]# service iptables reload

At this point, your basic Tomcat installation should be working fine, and serving a generic tomcat homepage once you access the URL http://<VM_IP>/8080

Configure tomcat to start during the server boot-up process

[root@linux tomcat]#   vi /etc/init.d/tomcat
              

Paste this inside the file

#!/bin/bash
# description: Start up the Tomcat servlet engine.
. /etc/init.d/functions
sleep 60  #make sure the DB is up
RETVAL=$?
CATALINA_HOME="/u01/app/tomcat/apache-tomcat-9.0.26"
case "$1" in
start)
if [ -f $CATALINA_HOME/bin/startup.sh ];
then
echo $"Starting Tomcat"
/bin/su tomcat $CATALINA_HOME/bin/startup.sh
fi
;;
stop)
if [ -f $CATALINA_HOME/bin/shutdown.sh ];
then
echo $"Stopping Tomcat"
/bin/su tomcat $CATALINA_HOME/bin/shutdown.sh
fi
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
;;
esac
exit $RETVAL
              

Add the script to the runlevel environment level 3 and 5

[root@linux tomcat]#   chmod 755 /etc/init.d/tomcat
[root@linux tomcat]#   cd /etc/rc3.d
[root@linux tomcat]#   ln -s /etc/init.d/tomcat S80tomcat
[root@linux tomcat]#   cd /etc/rc5.d
[root@linux tomcat]#   ln -s /etc/init.d/tomcat S80tomcat

Add APEX war to Tomcat

Copy the APEX images to the Tomcat “webapps” directory. This should be done as tomcat user

[tomcat@linux tomcat]$   mkdir -p /u01/app/tomcat/apache-tomcat-9.0.26/webapps/i/
[tomcat@linux tomcat]$   cp -R /u01/app/apex/images/* /u01/app/tomcat/apache-tomcat-9.0.26/webapps/i/

Copy the ORDS application ords.war to the Apache Tomcat. This should be done as tomcat user

[tomcat@linux tomcat]$   cp /u01/app/ords/ords.war /u01/app/tomcat/apache-tomcat-9.0.26/webapps/

You should now be able to access the APEX admin page at: the URL http://<VM_IP>/8080/ords

Add a comment