The Oracle APEX Listener is a Java based alternative to using Oracle HTTP Server (OHS) with mod_plsql. In the past I’ve installed early versions of APEX 3 using this configuration, then later on started using EPG (Embedded PL/SQL Gateway) which worked fairly well. Recently however, I decided to try using the latest APEX Listener 2.0.1 on WebLogic 12c with APEX 4.2.2 installed against a database on a separate server 🙂
Alternative options to deploying the APEX Listener on WebLogic would be to use Oracle Glassfish Server or the standalone mode. The use of HTTPS isn’t supported using standalone mode though, and in the real world should only be used for development purposes. WebLogic and Glassfish are much more scalable, flexible and secure options…
I’m assuming here that the installations of APEX and WebLogic 12c have already been performed and an appropriate domain exists, if not, then take a look at these posts:
- Installing APEX 4.2 and configuring Embedded PL/SQL Gateway (EPG)
- WebLogic Server 12c (12.1.1) installation
- Creating a Domain in WebLogic 11g or 12c
Unzip the APEX software
unzip /u01/app/oracle/software/apex_listener.126.96.36.199.14.25.zip -d /u01/app/oracle/apex_listener unzip /u01/app/oracle/software/apex_4.2.2_en.zip -d /u01/app/oracle
Configure the APEX Listener
By default, the APEX Listener configuration files are stored in /tmp/apex, which obviously isn’t a good place to keep them. Running the following command will specify an alternative location to store the configuration:
cd /u01/app/oracle/apex_listener java -jar apex.war configdir /u01/app/oracle/apex_listener May 01, 2013 11:35:48 AM oracle.dbtools.common.config.cmds.ConfigDir execute INFO: Set config.dir to /u01/app/oracle/apex_listener in: /u01/app/oracle/apex_listener/apex.war
Next, we configure the database connection details appropriate to where APEX 4.2.2 was installed:
java -jar apex.war setup May 01, 2013 11:36:03 AM oracle.dbtools.common.config.file.ConfigurationFolder logConfigFolder INFO: Using configuration folder: /u01/app/oracle/apex_listener/apex Enter the name of the database server [localhost]:linux03.vbox Enter the database listen port :1521 Enter 1 to specify the database service name, or 2 to specify the database SID :1 Enter the database service name:snap11g Enter the database user name [APEX_PUBLIC_USER]:APEX_PUBLIC_USER Enter the database password for APEX_PUBLIC_USER:password1 Confirm password: Enter 1 to enter passwords for the RESTful Services database users (APEX_LISTENER,APEX_REST_PUBLIC_USER), 2 to use the same password as used for APEX_PUBLIC_USER or, 3 to skip this step :2 May 01, 2013 11:37:12 AM oracle.dbtools.common.config.file.ConfigurationFiles update INFO: Updated configurations: defaults, apex, apex_al, apex_rt
While we’re on the subject of database connectivity, it’s a good idea to make sure the APEX_PUBLIC_USER account (or whichever user account you specified above) is unlocked and matches the password supplied above, otherwise you’ll hit “503 – Service Unavailable” messages when trying to access APEX later on:
SELECT username, account_status FROM dba_users WHERE username = 'APEX_PUBLIC_USER'; ALTER USER apex_public_user identified by password1 ACCOUNT UNLOCK;
Create a Web Archive (WAR) file for the APEX images
cd /u01/app/oracle/apex_listener java -jar apex.war static /u01/app/oracle/apex/images WAR Generation complete WAR location : /u01/app/oracle/apex_listener/i.war Context path : /i Static resources : /u01/app/oracle/apex/images
NOTE: This WAR file contains only references to the image files on disk, it doesn’t contain the images themselves, so don’t be tempted to remove the APEX images directory or rename it afterwards 😉
Deploy the WAR files
With the Admin Server up and running, log into the WebLogic Administration Console:
NOTE: If you’re running in Production mode, you’ll need to click the Lock & Edit button before continuing.
First of all we’ll deploy the apex.war file…
Select Deployments from underneath the Domain Structure, then click Install.
Navigate to /u01/app/oracle/apex_listener and select the apex.war file created earlier, click Next.
Leave the Install this deployment as an application option select and click Next.
Select the target server(s)/cluster(s) for deployment of the application and click Next.
Make sure the deployment is named ‘apex’ and use the following security model:
Custom Roles: Use roles that are defined in the Administration Console; use policies that are defined in the deployment descriptor
Leave everything else as defaults. then click Next.
Finally, select No I will review the configuration later and click Finish.
You’ll be returned to the Deployments page at this point.
Now repeat the process above, but this time deploy the i.war file, ensuring the deployment name is left as ‘i’.
Configure WebLogic to deal with HTTP Basic Authentication
WebLogic will attempt to intercept all HTTP Basic Authentication requests by default, so this needs to be disabled before the APEX Listener works correctly:
export DOMAIN_HOME=/u01/app/oracle/middleware/user_projects/domains/SnapDomain cd $DOMAIN_HOME/config cp config.xml config.xml.bak vi config.xml
Add the following element:
…into the config.xml file before closing tag </security-configuration>:
<security-configuration> ... <enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials> </security-configuration>
Save the changes, and then restart WebLogic:
$DOMAIN_HOME/bin/stopWebLogic.sh nohup $MW_HOME/user_projects/domains/SnapDomain/startWebLogic.sh > /dev/null 2>&1 & nohup $MW_HOME/user_projects/domains/SnapDomain/bin/startManagedWebLogic.sh ManagedServer_1 > /dev/null 2>&1 &
Check the deployments and test APEX connectivity
Once both WAR files have been deployed, and the WebLogic servers restarted as above, log back into the console and check that the deployments are active and healthy:
If they aren’t active, then start them by clicking on Start and Servicing all requests.
Finally, test connectivity using the new APEX Listener deployment to your APEX installation and you should get to the usual APEX login prompt:
One thing to point out here, is that if you’re tying to access something like this:
…well there isn’t a listenerConfigure page in APEX Listener 2 any longer (unlike previous versions). The configuration and maintenance web interface is gone, and can be managed through either SQL Developer or the command line now.