5 Replies Latest reply: Aug 30, 2012 1:14 PM by Tim,PA,USA RSS

    Configure Application Express Listener on multiple AJP ports for proxying

    945348
      I have two listeners configured, both running on the same machine and running against the same images location:

      java -Dapex.ajp=8009 -Dapex.home=/opt/local/apxapp/apex_home -Dapex.images=${apex_dir}/images -jar ${apex_dir}/apex.war
      java -Dapex.ajp=8010 -Dapex.home=/opt/local/apxapp/apex_home2 -Dapex.images=${apex_dir}/images -jar ${apex_dir}/apex.war

      How can I configure Apache to utilize this? I currently do this with the 8009 AJP listener:

      ProxyPass /apex ajp://apexhost:8009/apex
      ProxyPassReverse /apex https://www.apexurl.com/apex
      ProxyPass /i ajp://apexhost:8009/i
      ProxyPassReverse /i https://www.apexurl.com/i

      I would need for the 8010 AJP instance to serve out the "apex" directory as another name. Not sure how to accomplish that. Also unclear on the images (/i) part.

      Thanks
        • 1. Re: Configure Application Express Listener on multiple AJP ports for proxying
          Udo
          Hi,

          if you want one frontend proxy to serve more than one APEX Listener instance, you'll either have to deploy APEX Listener to a regular JEE Container that allows you to use different contexts for each instance, or you'll have to use different "virtual hosts" on your frontend, which allow you to reuse the context name again. Reason: In Standalone Mode you are limited to the fixed contexts "apex" and "i", and you are limited to a symmetric mapping on the reverse proxy.

          Example 1 (two instances on regular JEE using different contexts)
          ProxyPass /apex_instance_1 ajp://apexhost:8080/apex_instance_1
          ProxyPass /apex_instance_2 ajp://apexhost:8080/apex_instance_2
          # and accordingly for the images and reverse path 
          Example 2 (two instances in Standalone Mode using same contexts, different Virtual Hosts)
          <VirtualHost sub1.yourdomain.com:80>
          ProxyPass /apex ajp://apexhost:8009/apex
          ProxyPass /i ajp://apexhost:8009/i
          # and accordingly for the reverse path
          </VirtualHost>
          <VirtualHost sub2.yourdomain.com:80>
          ProxyPass /apex ajp://apexhost:8010/apex
          ProxyPass /i ajp://apexhost:8010/i
          # and accordingly for the reverse path
          </VirtualHost>
          I hope this helps you configure your two instances according to your needs.

          -Udo

          Edited by: Udo on 20.07.2012 15:53
          • 2. Re: Configure Application Express Listener on multiple AJP ports for proxying
            945348
            I've now deployed into Tomcat and have it working great through Apache (resolving issues seen in another thread!). However, this is only for the single instance.

            How can I create this second context within Tomcat that works with Apex? I understand Tomcat+Apex isn't officially supported.

            I'm currently starting tomcat with one of the JAVA_OPTS that includes:

            -Dapex.home=/opt/local/apxapp/apex_home

            I am attempting to learn how to do this with Tomcat contexts, but at the moment am not sure what the best solution is. I'm assuming it involves creating a secondary context xml file, but really unsure of the details.

            Thanks again for all of your assistance, Udo!
            • 3. Re: Configure Application Express Listener on multiple AJP ports for proxying
              Udo
              Hello,
              I understand Tomcat+Apex isn't officially supported.
              That's no problem, as I know pretty well that APEX Listener works great on Tomcat - when both are configured properly. ;)
              I'm currently starting tomcat with one of the JAVA_OPTS that includes:

              -Dapex.home=/opt/local/apxapp/apex_home
              You shouldn't do that. Instead, you can edit the web.xml of your apex.war to set the "config.dir". That way, each of your APEX Listener instance (using different contexts on Tomcat) can have it's own configuration path. See the [url http://docs.oracle.com/cd/E21611_01/doc.11/e21058/config_file.htm#BABHAJDD]APEX Listener Installation Guide for details on that part. I recommend to choose Option 1 ( +${config.dir}/<Mount-Point>/apex-config.xml+ ) where "Mount-Point" is the context you've deployed your apex.war to. If you use hot-deployment (just copying the war file into the webapps directory of your Tomcat), you need to rename it to the context name it shall use, e.g.
              # deploy for context /apex_instance_1
              cp apex.war $CATALINA_HOME/webapps/apex_instance_1.war
              # deploy for context /apex_instance_2
              cp apex.war $CATALINA_HOME/webapps/apex_instance_2.war
              Assuming your $CATALINA_HOME would be in +/opt/local/tomcat+ you could create a directory apex in +/opt/local/tomcat+ and a subdirectory for each APEX deployment there, e.g.
              mkdir $CATALINA_HOME/conf/apex
              mkdir $CATALINA_HOME/conf/apex/apex_instance_1
              mkdir $CATALINA_HOME/conf/apex/apex_instance_2
              Now, copy the apex-config.xml for each instance into the corresponding directory and (re)start your tomcat.
              If you don't want to configure the absolute directory path in your config, but reuse the $CATALINA_HOME, you should start your tomcat with
              -DAPEX_CONF=$CATALINA_HOME
              to pass the shell variable into the java environment and set the config.dir parameter to use that java environment variable, e.g.
              <param-value>${APEX_CONF}/conf/apex</param-value>
              The easiest way would be to "patch" the web.xml in your war file before deploying it, so you won't have to redo that change for each deployment.

              -Udo

              Edited by: Udo on 24.07.2012 17:46
              Unified examples to match contexts from previous posts
              • 4. Re: Configure Application Express Listener on multiple AJP ports for proxying
                945348
                Thanks again Udo for all of your recommendations. I have this configuration working.
                • 5. Re: Configure Application Express Listener on multiple AJP ports for proxying
                  Tim,PA,USA
                  Hello,
                  I have an Oracle 11.1.0.7 installation with APEX 4.1 on one database instance (our development environment). We now want to create a second environment (for testing) on the same machine. I was going to use the same Oracle Home and just create a second database instance. But I am unclear on how the HTTP service would be configured to support this second database instance?