UPDATE! As of ORDS 22.2.0 there is a command to generate web application for deployment to Apache Tomcat or Oracle WebLogic Server. See Deploying Oracle REST Data Services. The below article is informative and perhaps worth your time to get an understanding of web application deployment but there are supported, documented steps for achieving the same thing with the ORDS product. In fact, what is in the ORDS product is better because it also caters for jar content in the /lib/ext/ folder which this article does not cover.
ORDS 22.1.0 introduced a substantial set of changes: Java 11 as minimum, new command line interface and a new configuration directory structure. In fact it is a release that introduces a whole new deployment paradigm.
Deployment Options
What we knew as Standalone Mode in previous ORDS releases still exists and is now initiated through a serve command. The embedded Eclipse Jetty web server and servlet container engine is still at the heart of this convenient way to have ORDS listen HTTP/HTTPS traffic. The significant change is how the configuration directory is determined at startup. There is no longer a requirement to modify the distributed ords.war to set the configuration directory location.
Deployment on a supported servlet container, such as Oracle WebLogic Server or Apache Tomcat, is similarly impacted by this principle that the distributed ords.war should not be modified. A new mechanism for specifying the configuration directory when the application is deployed is required. The ORDS documentation covers the standard approach for a typical setup, use a Java System Property ( -Dconfig.url=/ords_config/ ), startup your server(s) and deploy the web application.
Single Server
For some developers that may not have a full production environment scaled out for high availability, or may be restricted in the Apache Tomcat or WebLogic Server deployment options, the approach to set different servers with their own ords.war and configuration is not always feasible. With previous ORDS releases they may have had the practice of deploying multiple ORDS web applications with different contexts and configurations. At first it would appear that the new direction in ORDS 22.1.0 makes that impossible but it is not. All that is required are a few extra steps.
Bake your own
For deploying to Apache Tomcat or WebLogic Server you can make your own, separate web application with the config.url baked in. Moreover, you can call it whatever makes sense in your context.
Heres a Python script to do that for you: create_deploy_war.py
This script produces a new web application archive file with the jars from the distributed ords.war and web.xml deployment descriptor has the configuration directory path set. That way, wherever it is deployed, it will refer to the specified configuration directory.
Usage: create_deploy_war <source ords.war> <destination war filename> <configuration directory>
For example, if I want to have two ORDS instances deployed called tom and jerry with two separate configuration directories and I have extracted the ORDS 22.1.0 to /opt/oracle/ords-22.1.0.105.1723/. The jerry web application will be configured with a default pool pointing to an Oracle 19c database. The tom web application will be configured with a default pool pointing to an Oracle 21c database. We will show both web applications have these configurations by using the REST Enabled SQL service in ORDS to return database version information. Before that, the web application files must first be created…
./create_deploy_war.py /opt/oracle/ords-22.1.0.105.1723/ords.war /scratch/ords_webapps/tom.jar /scratch/ords_configs/tom/
./create_deploy_war.py /opt/oracle/ords-22.1.0.105.1723/ords.war /scratch/ords_webapps/jerry.jar /scratch/ords_configs/jerry/
That will produce two web application war files in /scratch/ords_webapps/ and I can then deploy them…
Oracle WebLogic Server

curl -u hr:hr http://localhost:7001/jerry/hr/_/sql { "database_major_version" : 19, "database_minor_version" : 0, "database_product_name" : "Oracle", "database_product_version" : "Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production\nVersion 19.3.0.0.0", "env" : { "defaultTimeZone" : "GMT", "ordsVersion" : "22.1.0.r1051723" } }
curl -u hr:hr http://localhost:7001/tom/hr/_/sql { "database_major_version" : 21, "database_minor_version" : 0, "database_product_name" : "Oracle", "database_product_version" : "Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production\nVersion 21.3.0.0.0", "env" : { "defaultTimeZone" : "GMT", "ordsVersion" : "22.1.0.r1051723" } }
As you can see from the above, the different web applications have different context paths and are configured to use two different databases.
Apache Tomcat

curl -u hr:hr http://localhost:8080/jerry/hr/_/sql { "database_major_version" : 19, "database_minor_version" : 0, "database_product_name" : "Oracle", "database_product_version" : "Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production\nVersion 19.3.0.0.0", "env" : { "defaultTimeZone" : "GMT", "ordsVersion" : "22.1.0.r1051723" } }
curl -u hr:hr http://localhost:8080/tom/hr/_/sql { "database_major_version" : 21, "database_minor_version" : 0, "database_product_name" : "Oracle", "database_product_version" : "Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production\nVersion 21.3.0.0.0", "env" : { "defaultTimeZone" : "GMT", "ordsVersion" : "22.1.0.r1051723" } }
Similar behaviour with Apache Tomcat with two different web applications with their own, separate, configuration.
Summary
What I have demonstrated is a script which produces a new web application for deployment in Apache Tomcat or WebLogic Server. The script is written for Python 2 because that’s the version distributed with Oracle WebLogic Server. It creates a new web application based on the distributed ords.war but without the META-INF content. That content includes a signature digest of the web.xml which will be invalid when the new deployment descriptor is written to the new WAR file.
This is what makes it possible to have multiple ORDS instances deployed to the same server all with different configuration directories.
This is excellent. Thanks!
However, you say in your update “As of ORDS 22.2.0 there is a command to generate web application for deployment to Apache Tomcat or Oracle WebLogic Server.”.
The Oracle notes say “The recommended approach is to generate a Web Application archive file with the configuration directory location specified for that war file.” – but unless I’ve missed something there doesn’t seem to be anywhere that says exactly how this is done.
I think the command might be “ords war”, but this seems to do very little, any pointers?
LikeLike
One can specify the configuration directory directly or indirectly when using the ords command line interface. There are a number of options. The most common direct way is to provide the –config option. The most common indirect way is to just have the configuration directory as the working directory.
For example:
> ords –config /path/to/config war /path/to/tomcat/webapps/ords.war
or
> cd /path/to/config
> ords war /path/to/tomcat/webapps/ords.war
I hope that helps.
LikeLike