Monday, December 16, 2019

Oracle Apex 19.2 on Oracle database 18c XE issues when running on HTTP server 11.1.1


System setup


Oracle Apex 19.2
Oracle Database XE 18c (18.4)
Oracle OFM HTTP server 11 (11.1.1.9)

List of articles that I have been following


Oracle Apex 19.2 installation instructions
Popular CDB/PDB issue article online

Issues encountered after setting up Oracle Apex with HTTP server using articles above


Error provisioning XXXXXXXXXXXX. ORA-20001: Request 1824748984765804 could not be processed. PROVISION_COMPANY
- this basically means you are in the wrong DB. You are connected to CDB$ROOT instead of XEPDB1 (and not PDB1!)

ORA-65096: invalid common user or role name in oracle.

ORA-28040: No matching authentication protocol.

Lessons learned


You do not need install Apex as root
Oracle original documentation is missing examples or better explanation
XE has its own PDB naming prefix

Example dads.conf configuration file that worked


#Alias /i/ "ORACLE_HTTPSERVER_HOME/user_projects/domains/base_domain/images/"
Alias /i/ "/home/oracle/apex/images/"

<Location /apex>
 Order deny,allow
 AllowOverride None
 PlsqlDatabaseConnectString     i7mr:1521:XEPDB1 ServiceNameFormat
# PlsqlDatabaseConnectString     XEPDB1 TNSFormat
 PlsqlNLSLanguage               AMERICAN_AMERICA.AL32UTF8
 PlsqlAuthenticationMode        Basic
 SetHandler                     pls_handler
 PlsqlDocumentTablename         wwv_flow_file_objects$
 PlsqlDatabaseUsername          APEX_PUBLIC_USER
 PlsqlDefaultPage               apex
 PlsqlDatabasePassword          **********
 PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
 PlsqlPathAlias r
 PlsqlPathAliasProcedure wwv_flow.resolve_friendly_url
 Allow from all
</Location>

TL;DR


When you install Oracle XE 19.2 using installation manual there are 3 key steps missing:
1) you have to unlock APEX_PUBLIC_USER and ANONYMOUS user in PDB (XEPDB1) database
2) you have to setup HTTP server configuration file dads.conf to be connecting to the same PDB (XEPDB1)
3) Oracle XE has different PDB naming, they start with XE - XEPDB1 instead of normal PDB1 used in Oracle Std.

Its ok to install XE into CDB$ROOT. It goes there by default following installation instructions. After installation when you select:

select r.COMP_NAME, r.VERSION, c.NAME, c.CON_ID from CDB_REGISTRY r, V$CONTAINERS c where r.CON_ID=c.CON_ID and r.COMP_ID='APEX' order by CON_ID;

You get:

Oracle Application Express 19.2.0.00.18 CDB$ROOT          1
Oracle Application Express 19.2.0.00.18 XEPDB1          3

When installing XE make sure you add these few steps (some of them are not necessary, just leaving them here for more context):

alter session set container=XEPDB1;
exec dbms_xdb.sethttpport(0);
alter system register;
@apxchpwd
alter user APEX_PUBLIC_USER account unlock;
alter user ANONYMOUS account unlock;

The key problem here is that Apex installs to CDB$ROOT and XEPDB1, just you have to unlock users in XEPDB1 and setup your dads.conf configuration to connect to XEPDB1.

After that configure dads.conf, just pay attention to the bolded part - when connecting to instance, its not XE, it has to be XEPDB1.

In case you still get error ORA-28040: No matching authentication protocol, make sure you add these to /opt/oracle/product/18c/dbhomeXE/network/admin/sqlnet.ora

SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 8
SQLNET.ALLOWED_LOGON_VERSION_SERVER = 8

And restart HTTP server:

opmnctl stopall
opmnctl startall

The key problem indicators after installing Apex and connecting it to HTTP server is path that can be seen when creating empty Apex workspace. Here is how it looks like before PROVISION_COMPANY error:













And here is where it should go: