Wednesday, December 19, 2012

APEX: Running multiple version on single Weblogic Server

Sometimes you would like to have multiple versions of APEX running on one Weblogic Server, or Weblogic Cluster. For example, you would like to run APEX version 4.0 and version 4.2 along each other.

To configure this is rather simple and straight forward. The trick is to use the various WAR files; apex.war and images.war under a different name and use plan files to manipulate the root and image directories.

The following actions should be carried out:

make sure you have different WAR files of the APEX application in a single directory on your Admin server:

$ cd /data/deploy
$ ls -1
apex.4.0.war
apex.4.2.war
images.4.0.war
images.4.2.war


Create a plan directory to store your plan-files to overule the WEB properties

$ mkdir -p /data/user_projects/domains/APEX/plan/apex
$ ls -1
plan-images.4.0.xml
plan-images.4.2.xml
plan.4.0.xml
plan.4.2.xml


Make sure you have these files in this directory. Here is an example of the APEX plan-images file, to create your own plan file:

plan-images.4.2.xml
<?xml version='1.0' encoding='UTF-8'?> 
<deployment-plan xmlns="http://xmlns.oracle.com/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd" global-variables="false">
 
<application-name>apex.war


  <variable-definition>
     
<variable>
         
<name>apex-images-root</name>
         
<value>apex-images-42</value>
     
</variable>
 
</variable-definition>

 
<module-override>

   
<module-name>images.4.2.war</module-name>
   
<module-type>war</module-type>

   
<module-descriptor external="false">
     
<root-element>weblogic-web-app</root-element>
     
<uri>WEB-INF/weblogic.xml</uri>

     
<variable-assignment>
       
<name>apex-images-root</name>
       
<xpath>/weblogic-web-app/context-root</xpath>
     
</variable-assignment>

   
</module-descriptor>
 
</module-override>

 
<config-root>/data/tmp/apex</config-root> </deployment-plan>

Here is an example of the APEX plan file:

plan.4.2.xml 
<?xml version='1.0' encoding='UTF-8'?> 
<deployment-plan xmlns="http://xmlns.oracle.com/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd" global-variables="false">
 
<application-name>apex.4.2.war</application-name>

 
<variable-definition>
     
<variable>
         
<name>apex-root</name>
         
<value>apex-42</value>
     
</variable>
     
<variable>
         
<name>apex-config</name>
         
<value>/data/configuration/4.2</value>
     
</variable>
 
</variable-definition>

 
<module-override>
   
<module-name>apex.4.2.war</module-name>
   
<module-type>war</module-type>

   
<module-descriptor external="false">
     
<root-element>weblogic-web-app</root-element>
     
<uri>WEB-INF/weblogic.xml</uri>

     
<variable-assignment>
       
<name>apex-root</name>
       
<xpath>/weblogic-web-app/context-root</xpath>
     
</variable-assignment>

   
</module-descriptor>

   
<module-descriptor external="false">
     
<root-element>web-app</root-element>
     
<uri>WEB-INF/web.xml</uri>

     
<variable-assignment>
        
<name>apex-config</name>
        
<xpath>/web-app/context-param/[param-name="config.dir"]/param-value</xpath>
        
<operation>add

      </variable-assignment>

   
</module-descriptor>
 
</module-override>

 
<config-root>/data/tmp/apex</config-root></deployment-plan>

Now comes the deployment part, which is straight forward as a normal application.
  • Logon to Adminconsole
  • Lock & Edit to open session
  • Deploy images.4.0.war with plan file plan-images.4.0.xml
  • Deploy images.4.2.war with plan file plan-images.4.2.xml
  • Deploy apex.4.0.war with plan file plan.4.0.xml
  • Deploy apex.4.2.war with plan file plan.4.2.xml
  • Activate changes
  • Start running the images applications for all requests
  • Start running the apex applications for all requests
While we have overuled the default images direcotry from '/i' into '/apex-images-42' or '/apex-images-40', we should run some SQL scripts to update the APEX data. The following SQL code should be execute on the database for the specific APEX version

declare
    l_stmt varchar2(4000);
begin
    l_stmt := 'create or replace package wwv_flow_image_prefix
is
    g_image_prefix       constant varchar2(255) := ''/
apex-images-42/'';
end wwv_flow_image_prefix;';

    execute immediate l_stmt;
end;
/

update wwv_flows
       set flow_image_prefix = '/apex-images-42/'
     where flow_image_prefix = '/i/';

commit;

begin
    wwv_flow_page_cache_api.purge_all;
end;
/

commit;

begin
    dbms_utility.compile_schema(schema => 'APEX_040200', compile_all => FALSE);
end;
/


Now you are able to run multiple APEX applications from onw Weblogic Server/Cluster:

http://:/apex-42
http://:/apex-40


Saturday, September 22, 2012

Review: Oracle SOA Suite 11g Administration Handbook

While Packt Publishing is almost ready to publish their 1000th title. They will celebrate this with an  the event. As the mentioned on their site:

"Packt would like you to join them in celebrating this milestone with a surprise gift. Revisit Packt’s website between the 28th and 30th of September to redeem your gift, or sign up for an account with us now to receive a notification email.

Packt supports many of the Open Source projects covered by its books through a project royalty donation, which has contributed over $400,000 to Open Source projects. As part of the 1000th book celebration Packt is allocating $30,000 to share between projects and authors."

I had the opportunity to review the new administration handbook of the Oracle SOA Suite 11g.


 







Here are my comments on this book.

The book is filling a gap in the Oracle SOA world. This book is really focusing on administration and monitoring of the SOA11g environment. The book is not a summary of the Oracle Manuals with some screen shots based on an example application, but it gives you also different best practises, idea's, and good examples on maintaining your environment.

The chapter on tuning your SOA11g environment is very good! It covers O/S, application server, database and the various component within the SOA Suite.

I missing only a good script in the chapter on maintaining  your SOA instances. The examples are based on the de supplied scripts of Oracle, but those script do not purge all the data.