Installing and configuring the APEX Listener 2.0.1 on WebLogic 12c

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:

Unzip the APEX software

First of all, you need both the APEX Listener, and the APEX 4.2.2 software present on your WebLogic server (APEX 4.2.2 binaries are required for the images):

unzip /u01/app/oracle/software/apex_listener.2.0.1.64.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]:1521
Enter 1 to specify the database service name, or 2 to specify the database SID [1]: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 [1]: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:

http://linux05.vbox:7001/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:

<enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials>

…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:

http://linux05:7010/apex
https://linux05:7510/apex (SSL)

One thing to point out here, is that if you’re tying to access something like this:

http://linux05:7010/apex/listenerConfigure

…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.

References:
Application Express Listener Installation and Developer Guide

14 thoughts on “Installing and configuring the APEX Listener 2.0.1 on WebLogic 12c

  1. Hello,

    Very nice and clear steps for using apex on WLS.
    We have a scenario where we need to have redundant web nodes for APEX (meaning 2 web nodes working on the same APEX installation simultaneously)

    What is the best way do you suggest to achieve this using WLS? should we install WLS on both the nodes and cretae a cluster before deployment?
    if yes, how different would the deployment process would be?

    thanks,

    • Hi,

      Thanks for the comments. I’ve not tried this myself, but yes, you would certainly start by installing WLS on each of your nodes, and creating a clustered domain (there is a guide for that here).

      Once that’s done, the best solution would probably be to use a network share (with redundancy) for storing the APEX images and listener configuration files, accessible by each node. So when you unzip the software, create the apex.war and i.war files etc, you would reference the share, instead of /u01/app…

      The deployment would be done in the same way, you would just deploy the WAR files to the cluster target you’ve created.

      An alternative to the network share (if the directory structure is the same on each node) that you might be able to get away with, would be doing something below, and then keeping the directories in-sync with a utility like rsync:

      --TAR up the APEX directories
      tar -cvf /u01/app/oracle/apex_listener.tar /u01/app/oracle/apex_listener
      tar -cvf /u01/app/oracle/apex/images.tar /u01/app/oracle/apex/images
      
      --Copy them across to your second node
      scp /u01/app/oracle/apex_listener.tar :/u01/app/oracle
      scp /u01/app/oracle/apex/images.tar :/u01/app/oracle/apex
      
      --UNTAR the contents
      untar -xvf /u01/app/oracle/apex_listener.tar
      untar -xvf /u01/app/oracle/apex/images.tar
      
      --Add an rsync job to keep the files in-sync as appropriate

      Obviously this all needs testing out first though… 🙂 it might also be worth posting a note in the Oracle APEX Listener forum here.

      Hope this helps…

      • Garth,

        Thanks a lot for your response!

        That was a nice idea. i am planning to use a network share to avoid the sync’s and the problems that might occur in the interval time between two syncs

        However, I’m a little confused on one part, more because of my lack of knowledge on the product. To create war for images ( /i/ ) you used :

        java -jar apex.war static /u01/app/oracle/apex/images

        and you still warned not to delete the images off the file system. why is so? once deployed do we still need them on the server?

        what if I use something like below :

        jar –cvf i.war –C /u01/app/oracle/apex/images

        Shouldn’t above just copy the images while packing them as a WAR file? in that case we may remove the images directory

        also, lets say after 6 months of deploying it onto the weblogic, the users put some additional images under /images directory. Do we need to create WAR of images again and redeploy it? if yes, what is the option to avoid this ‘redeploy’ frequently

        Thanks in advance for help,

  2. Hi Garth,

    Thanks for providing detailed explanation of APEX with Weblogic.

    Can you please help post related to SSL configuration also for APEX on weblogic.

    Thanks & Regards,
    Sarath

    • Thanks Sarath. You just need to use the HTTPS ports of the Managed Server(s) you deployed the APEX WAR files to earlier, instead of the HTTP port(s). Demo SSL certificates are pre-bundled with WebLogic, so for Production you may wish to use certificates from an external Certificate Authority (CA).

      If you didn’t enable SSL at the time of creating the Managed Server(s), you can do so by logging into the Admin Console and doing the following:

      Environment -> Servers -> Your-Managed-Server -> Configuration -> General
      Tick “SSL Listen Port Enabled” and supply an appropriate “SSL Listen Port”
      Click on Apply.
      Restart the Managed Server(s).

      WebLogic is now configured for one-way SSL using the pre-bundled demo certificates.

      Hope this helps…

  3. What a brilliant walk through… did all the steps above including installing Apex 4.2.2, creating a new domain on WL and then installing Apex listener..

    Keep up the good work Garth…

  4. Hello Garth,

    This guide help me a lot. Thank you very much and keep doing this great work!!!

    Regards,
    Rafael Melo – BR

Leave a comment

Your email address will not be published.