Sunday, August 2, 2020

HTTP 404 when enabling Friendly URLs or referencing Static Application Files using substitution string #APP_IMAGES#

Updated on Saturday, Nov 6, 2021 with following,

APEX/ORDS database accounts could also cause this issue, diagnose & solution regarding these accounts are added.
As it is known, Oracle is trying to deprecate two web listeners Oracle HTTP Server (mod_plsql) and Embedded PL/SQL Gateway, and Oracle REST Data Services (ORDS) will be the only supported web listener for APEX.

However, if ORDS is not configured properly, error HTTP/HTTPS 404 could happen when

1. Friendly URLs property is enabled in APEX application

Error message as following
404 Not Found

When Friendly URLs property is enabled, the URL format looks like

Here, myworkspace is the value of RESTful Path Prefix property of APEX Workspace, default to the workspace name; myapp is the value of Application Alias property of APEX Application, default to the application name.

If Friendly URLs property is disabled, the URL format looks like

Here, 101 is the application ID of APEX application.

2. Substitution string #APP_IMAGES# is used to reference an image in Static Application Files

Error message as following
404 Not Found
The request could not be mapped to any database. Check the request URL is correct, and that URL to database mappings have been correctly configured

The referencing syntax looks like
<img src="#APP_IMAGES#logo.gif">

It will be translated into following format before sent to browser,
<img src="test/r/101/files/static/v4/logo.gif">

It is one of following issues:

1.  APEX/ORDS database account(s) is/are locked or password-expired
2.  ORDS is not configured properly. E.g., incorrect option is chosen while installing ORDS 


1.  Validate following APEX/ORDS database accounts' status,


Validation SQL as following (run as system or sys)
select username,account_status
  from dba_users
Sample output, 
------------------------- --------------
If any account's status is not open, you have to fix it by unlocking or resetting password. If the password is changed, you also have to change the password in ORDS configuration file.

2. If all accounts' status are OPEN, the errors are caused by incorrect ORDS configuration. They can be fixed by executing following command
java -jar ords.war validate --database apex

If the error is still there, try following command
java -jar ords.war install advanced


Fernando said...

Here I describe what, in my case, was the real problem for this issue. Hopefully it can help somebody:


DBA Plus said...

Thank you Fernando for your sharing!

I updated my post based with validating apex/ords accounts based on your suggestion.