Skip to main content

Configure Oracle APEX 3.2.1 using Embedded PL/SQL Gateway (Unsupported Feature)

Just want to share for those who don't want to setup APEX using Apache HTTP Server with mod_plsql (which will be deprecated according to latest SOD Oracle), instead using pre installed Embedded PL/SQL Gateway on top of XML DB Server feature of Oracle Database, but doesn't have the luxury of newest version of Oracle Database (as latest is 11g).

Installation step should be followed normally as documented in installation guide.

After APEX component installation complete (no error occured during installation)
using SQL/Plus Command:

SQL> @apexins SYSAUX SYSAUX TEMP /i/

*) SYSAUX should be replace by another target tablespace created earlier (recommended)

For normal installation it should move to point 3.3.5 Configure the Embedded PL/SQL Gateway but after several times installation experience this always causing error 404 Unauthorized.

I began to examine the instalation script, and found out that there's missing step in creation/configure of DAD (Database Access Descriptor) in:
default installation script => apex_epg_config_core.sql. called by apex_epg_config.sql script.

So the script needs to be patch in several lines after line 345 as the following:

--- Original Script
alter session set current_schema = XDB;

begin
dbms_epg.create_dad('APEX','/apex/*');
dbms_epg.set_dad_attribute('APEX','database-username','ANONYMOUS');
dbms_epg.set_dad_attribute('APEX','default-page','apex');
dbms_epg.set_dad_attribute('APEX','document-table-name','wwv_flow_file_objects$');
dbms_epg.set_dad_attribute('APEX','document-path','docs');
dbms_epg.set_dad_attribute('APEX','nls-language','american_america.al32utf8');
dbms_epg.set_dad_attribute('APEX','document-procedure','wwv_flow_file_mgr.process_download');
dbms_epg.set_dad_attribute('APEX','request-validation-function','wwv_flow_epg_include_modules.authorize');
end;
--- Patched Script
alter session set current_schema = XDB;

begin
dbms_epg.create_dad('APEX','/apex/*');
dbms_epg.authorize_dad (
dad_name => 'APEX',
user => 'ANONYMOUS'); -- Mesz
dbms_epg.set_dad_attribute('APEX','database-username','ANONYMOUS');
dbms_epg.set_dad_attribute('APEX','default-page','apex');
dbms_epg.set_dad_attribute('APEX','document-table-name','wwv_flow_file_objects$');
dbms_epg.set_dad_attribute('APEX','document-path','docs');
dbms_epg.set_dad_attribute('APEX','nls-language','american_america.al32utf8');
dbms_epg.set_dad_attribute('APEX','document-procedure','wwv_flow_file_mgr.process_download');
dbms_epg.set_dad_attribute('APEX','request-validation-function','wwv_flow_epg_include_modules.authorize');
end;

So you have to rerun EPG configuration using your patch script as describe in installation guide:

On Windows:
SQL> @apex_epg_config SYSTEM_DRIVE:\TEMP
On UNIX and Linux:
SQL> @apex_epg_config /tmp
and then unlock anonymous acount ( the next step) .

*) For detailed explanation of SYSTEM_DRIVE:\TEMP or /tmp please read installation guide.

But it's still will not allowing anonymous access to APEX so the last step required is executing script below (thanks to Oracle-Base)
-- Script to Update Allow Anonymous Acces to XDB
-- For APEX without Apache Instalation
-- MKR, 2009.11.17
DECLARE
l_configxml XMLTYPE;
l_value VARCHAR2(5) := 'true'; -- (true/false)
BEGIN
l_configxml := DBMS_XDB.cfg_get();

IF l_configxml.existsNode('/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access') = 0 THEN
-- Add missing element.
SELECT insertChildXML
(
l_configxml,
'/xdbconfig/sysconfig/protocolconfig/httpconfig',
'allow-repository-anonymous-access',
XMLType(''
|| l_value ||
''),
'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
)
INTO l_configxml
FROM dual;

DBMS_OUTPUT.put_line('Element inserted.');
ELSE
-- Update existing element.
SELECT updateXML
(
DBMS_XDB.cfg_get(),
'/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access/text()',
l_value,
'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
)
INTO l_configxml
FROM dual;

DBMS_OUTPUT.put_line('Element updated.');
END IF;

DBMS_XDB.cfg_update(l_configxml);
DBMS_XDB.cfg_refresh;
END;
/
commit;
/


If the above script give you error:




probably work around alternative script below will solve it.

--Script work around
DECLARE
configxml XMLType;
configxml2 XMLType;
BEGIN
-- Get the current configuration
configxml := DBMS_XDB.cfg_get();

-- Modify the configuration
SELECT INSERTCHILDXML(
configxml,
'/xdbconfig/sysconfig/protocolconfig/httpconfig',
'allow-repository-anonymous-access',
XMLType('true'),
'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"')
INTO configxml2 FROM DUAL;
-- Update the configuration to use the modified version
DBMS_XDB.cfg_update(configxml2);
END;
/
commit;
/
UPDATE resource_view r
SET r.res=UPDATEXML(res, '/a:Resource/a:Contents/b:acl','
xmlns="http://xmlns.oracle.com/xdb/acl.xsd"
xmlns:dav="DAV:"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd http://xmlns.oracle.com/xdb/acl.xsd"
>

true
ANONYMOUS




',
'xmlns:a="http://xmlns.oracle.com/xdb/XDBResource.xsd" xmlns:b="http://xmlns.oracle.com/xdb/acl.xsd"') WHERE r.any_path = '/sys/acls/ro_anonymous_acl.xml';

After all these unofficial patched step please restart your database.

Hopefully now you can access your APEX home => http://your-host:8080/apex/

Remember that this is not officially supported configuration by Oracle and I think it's not the recommended setup for production site. So the risk is all yours.

I personally used this solution in my Development host only.

Happy patching,
Mesz

Comments

Popular posts from this blog

Sekelumit kisah tentang Nokia N900 - Part I

Bermula dari ketertarikan dengan sebuah perangkat yg menurut review sangat (mungkin paling) mumpuni saat itu, sekitar April - Mei 2010. Setelah baca banyak review juga terhadap perangkat tersebut, akhirnya Saya memutuskan untuk menebus perangkat Nokia N900 tersebut pada 30 Mei 2010 , walaupun untuk mendapatkannya ternyata harus keliling dulu ke beberapa authorized reseller Nokia karena peredarannya agak terbatas. Dan ternyata setelah beberapa waktu menggunakannya memang terbukti sangat mumpuni and the device had satisfied me almost everything I need for a sophisticated device . Setelah hampir 7 bulan menggunakannya (awal Desember 2010), mulai terasa ada keanehan, gejalanya adalah kalo mau dicharge harus dalam posisi berdiri (dimana bagian mini USB Port nya berada diatas) dan kabel chargenya harus diposisikan kebelakang supaya bisa dicharge, kalo tidak begini proses charging nya jadi suka on/off. Waktu itu tidak banyak berprasangka aneh-aneh, cuman berpikiran mungkin emang perlu ada sed...

Configure Reverse Proxy Apache 2 for Oracle APEX 4.0

Just taking note reminder for myself, it's about how to configuring Apache 2 HTTP Server (Not OHS come with Compl CD of Oracle Database) as a front end HTTP Server for APEX 4.0 installed in Oracle XE 10g. Just follow the step as explain below: Install Apache 2.2 Server (Source can be downloaded from http://httpd.apache.org/download.cgi) installed with listening port configure at 8888 Install Oracle XE 10g Database (Download from http://www.oracle.com/technetwork/database/express-edition/downloads/index.html) installed with listening port configure at 7777 Install APEX 4.0 (Download from http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html) After those development tools installed last thing to do is Configure Apache2 to become front server and static images server for APEX 4.0 then do the following steps: Enable/Activate module mod_proxy, proxy_http_module with LoadModule Directive. Configuration example: LoadModule proxy_module /usr/...

Intel 3945 Wifi Card Problem Easy Troubleshoot in Ubuntu 10.10

Recently just change my mind to switch back OS to pure Ubuntu (not its derivative). I've been using Mint version of Ubuntu derivative for 2 years. Gradually move with upgrade from Mint 5, Mint 8 to Mint 9 (KDE). Last upgrade (Mint 9 KDE) was to 64 Bit version about 8 months ago. Today just upgrade to 10.10 Ubuntu and find out that I couldn't access office wireless network. After googling, I find out a simple solution from this links So just type this in your terminal: sudo rfkill unblock wifi Type 'dmesg | grep iwl' to see the result that should inform something like this: iwl3945 0000:07:00.0: loaded firmware version 15.32.2.9 And of course available Wifi Network now should appear in Network Manager applet drop down. See picture below for more verbose outcome. After this then I'll applied PAE Kernel to utilized unused 1 GB RAM in my laptop, since 32-bit linux without PAE can only used maximum 3 GB of RAM (mine is 4 GB),... hehehe I'm back to 32-bit world again,...