Friday 21 March 2014

Fault Handling Framework JAVA Custom Faults using fault policies properties

What I'm trying to achieve: Custom fault handling action on my fault policies that can publish a file to my file system before any handled fault is delivered to manual intervention on recovery EM area. This way will allow me to alert via platform management tool that an error occurred. Now, I want this flexible enough so I can change file content and location based on different targeted environments during my application promotion.

Implementation

  1. Create a generic JDeveloper project leaving the default options. 
  2. Add JAVA technology. Accept the creation of a new project and define the name.
  3. Define the default package where to create your java classes
  4. Add the necessary libraries
    • BPEL Runtime
    • SOA Runtime


Note: Right Click on project and choose Project Properties to access to Libraries and Classpath option.

Now:
  1. Create a new class (eg. Logging) inside the defined default package
  2. Copy/Paste the following code to the created class (Note: the package name should match the default package name that you defined)
package sample.faulthandling.custom.action;

import com.collaxa.cube.engine.fp.BPELFaultRecoveryContextImpl;

import java.io.BufferedWriter;
import java.io.File;

import java.io.FileWriter;

import java.util.ArrayList;
import java.util.Map;
import java.util.Properties;

import oracle.integration.platform.faultpolicy.IFaultRecoveryContext;
import oracle.integration.platform.faultpolicy.IFaultRecoveryJavaClass;


public class logging implements IFaultRecoveryJavaClass {
    public void handleRetrySuccess(IFaultRecoveryContext ctx) {
        System.out.println("This is for retry success");
        handleFault(ctx);
    }

    public String handleFault(IFaultRecoveryContext ctx) {
        System.out.println(" #### EXAMPLE ###### Action context:\n" +
                ctx.toString());

        // Get BPEL specific context here
        BPELFaultRecoveryContextImpl bpelCtx =
            (BPELFaultRecoveryContextImpl)ctx;

        // Writing an audit entry
        bpelCtx.addAuditTrailEntry(" ### SAMPLE Custom Fault Handling Example ### ");

        // Getting details
        System.out.println("Policy Id: " + ctx.getPolicyId());
        System.out.println("Composite Name: " + bpelCtx.getCompositeName());
            
        Map<String, ArrayList> props = ctx.getProperties();
        
        String logFileName = (String)((ArrayList)props.get("logFileName")).get(0);
        String logFileDir = (String)((ArrayList)props.get("logFileDir")).get(0);
        String message = (String)((ArrayList)props.get("message")).get(0);

        String content = message + " - Composite:" + bpelCtx.getCompositeName() + " InstanceID:" + bpelCtx.getCompositeInstanceId()
            + " Activity:" + bpelCtx.getActivityName() + " Fault:" + bpelCtx.getFault();

        File file = new File(logFileDir + logFileName);
        try {
            if (!file.exists()) {
                file.createNewFile();
            }

            FileWriter fw = new FileWriter(file.getAbsoluteFile());
            BufferedWriter bw = new BufferedWriter(fw);
            bw.write(content);
            bw.close();

        } catch (Exception e) {
            
        }
            return "MANUAL";

    }
}


1.      Create a new deployment profile to generate a JAR file (e.g. CustomFaultJavaAction.jar)

Note: Right Click on project and choose Project Properties to access to Deployment Profiles.

Now, deploy to a JAR file using the created deployment profile.

Deployment


1. Copy the deployed JAR file to the "oracle.soa.ext_11.1.1" directory
Note: You will find this SOA extension in [fmw_home]/Oracle_SOA1/soa/modules/oracle.soa.ext_11.1.1/

2. Update the environment variables running the appropriate domain setDomainEnv.sh
Note: [fmw_home]/user_projects/domains/[your_domain]/bin

3. soa.ext build file uses If condition, default ANT installation available on SOA suite is not ready to use If conditions by default. It will be necessary to update both Ant Library and soa.ext build file to be able to incorporate this functionality. So you have to:
  • Download ant contrib jar file http://switch.dl.sourceforge.net/project/ant-contrib/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip
  • Unzip file and copy lib/ant-contrib.jar to your Ant lib folder
    Note: Ant is available on your SOA Suite installations. The location is: [fmw_home]/modules/org.apache.ant_1.7.1
  • It is necessary to reference now the Ant Contrib library from the build.xml file used to build the SOA ext. So edit the build.xml file contained on oracle.soa.ext_11.1.1 folder and add the element <taskdef resource="net/sf/antcontrib/antlib.xml"/> after the project element.

4. Run Ant on oracle.soa.ext_11.1.1 folder. Your build target should produce then the following output:

[oracle@soabpm-vm oracle.soa.ext_11.1.1]$ /oracle/fmwhome/modules/org.apache.ant_1.7.1/bin/ant
Buildfile: build.xml

create-manifest-jar:
     [echo] Creating oracle.soa.ext at /oracle/fmwhome/Oracle_SOA1/soa/modules/oracle.soa.ext_11.1.1/oracle.soa.ext.jar :/oracle/fmwhome/Oracle_SOA1/soa/modules/oracle.soa.ext_11.1.1/CustomFaultJavaAction.jar:/oracle/fmwhome/Oracle_SOA1/soa/modules/oracle.soa.ext_11.1.1/classes

BUILD SUCCESSFUL
Total time: 0 seconds

Note: Ant is available on your installations of SOA suite in:[fmw_home]/modules/org.apache.ant_1.7.1

5. Now it is time to restart your SOA server. :)

Fault Policy Configuration

1. The following example can be follow to be able to use the implemented custom fault action. Change your fault policy file to include the custom action following the next example:

<?xml version="1.0" encoding="UTF-8"?>
<faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <faultPolicy version="0.0.1" id="FusionMidFaults"
               xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:xs="http://www.w3.org/2001/XMLSchema"
               xmlns="http://schemas.oracle.com/bpel/faultpolicy"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Conditions>
      <faultName>
        <condition>
          <action ref="ora-retry"/>
        </condition>
      </faultName>
    </Conditions>
    <Actions>
      <Action id="ora-retry">
        <retry>
          <retryCount>3</retryCount>
          <retryInterval>2</retryInterval>
          <exponentialBackoff/>
          <retryFailureAction ref="my-custom-java"/>
        </retry>
      </Action>
      <Action id="my-custom-java">
        <!-- this is user provided class-->
        <javaAction className="sample.faulthandling.custom.action.logging"
                    defaultAction="default-human-intervention"
                    propertySet="prop-for-my-monitoring">
          <returnValue value="MANUAL" ref="default-human-intervention"/>
          <returnValue value="ABORT" ref="default-terminate"/>
          <returnValue value="RETHROW" ref="default-rethrow-fault"/>
        </javaAction>
      </Action>
      <!-- Generics -->
      <Action id="default-terminate">
        <abort/>
      </Action>
      <Action id="default-replay-scope">
        <replayScope/>
      </Action>
      <Action id="default-rethrow-fault">
        <rethrowFault/>
      </Action>
      <Action id="default-human-intervention">
        <humanIntervention/>
      </Action>
    </Actions>
    <Properties>
      <propertySet name="prop-for-my-monitoring">
        <property name="logFileName">my-soa-faults.log</property>
        <property name="logFileDir">/home/oracle/logs/</property>
        <property name="message">### SAMPLE Custom Fault Handling Example ###</property>
      </propertySet>
    </Properties>
  </faultPolicy>
</faultPolicies>

2. Deploy the policies file (composite or MDS) and test.

Conclusions

This will allow you to manage your properties per fault-policy referencing fault policies files that are available on MDS of the targeted server, managing this way the properties that will influence your fault handling custom actions depending on the environment of your application life cycle.

Thursday 6 March 2014

QTJava.zip exception starting local weblogic jdeveloper instance

Problem: Starting a new jDeveloper 11.1.17 Weblogic instance get the error - \Java\jre7\lib\ext\QTJava.zip was unexpected at this time. Process exited.

Solution: Check if QTJava.zip is set on the $CLASSPATH environment variable, if it is remove it from the variable and restart the machine.

Use proxy configuration when invoking webservices

Introduction


Sometimes, its necessary to access webservices only accessible through web proxy. This configuration can be maintained both server level or composite level. Of course maintaining this on server level you are maintaining the proxy configuration for every service invocation.

Maintained on composite level, better, on reference level guarantees different configuration during invocation time.

Server Level


The proxy configuration at server level can be accessed  on EM SOA Aministration / Common Properties / More SOA Advanced Configuration / Properties

Here you will find the properties:

  • HttpProxyHost
  • HttpProxyPort
  • HttpProxyUsername 
  • HttpProxyPassword

Restart the server after changing them.

Composite Level


At the composite level the proxy configuration is maintained at the reference webservice: select the reference, change the binding properties 

This changes can be delivered directely on the composite.xml aswell

  <reference name="thisWS" ui:wsdlLocation="thisWS.wsdl">
    <interface.wsdl interface="https:/host/#wsdl.interface(thisWsaSoap)"/>
    <binding.ws port="https://host/#wsdl.endpoint(thisWsa/thisWsaSoap12)"
                location="thisWs.wsdl" soapVersion="1.2">
      <property name="oracle.webservices.proxyHost" type="xs:anyURI"
                many="false" override="may">10.xxx.xxx.xx</property>
      <property name="oracle.webservices.proxyPort" type="xs:integer"
                many="false" override="may">8080</property>
    </binding.ws>
    <binding.ws port="https:/host/#wsdl.endpoint(thisWs/thisWsSoap)"
                location="thisWs.wsdl" soapVersion="1.1">
      <property name="weblogic.wsee.wsat.transaction.flowOption"
                type="xs:string" many="false">WSDLDriven</property>
      </binding.ws>
  </reference>

After deployment the properties are accessible from the Enterprise Manager console on the composite administration area. Just need to access the reference available on adapter list and configure the properties directly in the console.

Other considerations

  • Of course have in mind that you should maintain this reference properties on SOA configuration plans to manage the composite migration between environments.

Tuesday 4 March 2014

Installing Oracle E-Business Suite 12.2 on Red Hat

Introduction


First of all, many thanks for John Piowar for sharing this post on how to install Oracle EBS. This post was then my guidelines to perform an fresh installation of Oracle e-business suite version 12.2.0. The intention of this post is not to copy what John wrote, its to share my experience on top of what is written on the blog and on official Oracle Documentation.

Server Specifications

  • OS - Red Hat EL 6 - 64bit
  • Disk - 420 Gb
  • Memory 16Gb
  • Hostame: ebs001.mydomain.com
  • DB SID: VIS

Users

used and created the following users:

root/password
oracle/oracle
oravis/oracle
applvis/oracle

weblogic/welcome1


For other users default passwords follow the defined on official documentation:

apps/apps
SYSADMIN/SYSADMIN

Folders

Created the following folders.

/oracle/
/oracle/zips
/oracle/soPackages
/oracle/oraInventory
/oracle/Stage1222
/oracle/VIS
/oracle/Stage122/startCD/Disk1/rapidwiz

Note: run rapidInstall with root
On Wizard use oravis and applvis users

Bare in mind

Following this instructions can keep you from spending hours and hours of bad installation attempts, read it carefully ! :)
  • Be sure about all steps on the installation documents before starting installing. OUI installation will take !!! hours !!! to complete or raise an exception if not all steps are followed.
  • Change hostname if hostname + DbSid longer than 30 characters
  • Use wget to get rapidly the files from e-delivery and Oracle Support (wget "<URL>" -O <ZIP_NAME>) or use cookies.txt
  • Maintain the name of the zip files when downloading
  • Download only VISION. PROD Is not necessary
  • Use yum install `cat packages.txt to install all required OS packages in once action (check http://www.pythian.com/blog/getting-ready-to-install-ebs-12-2-vision-quickstart-notes/#os)
  • Be careful with what you maintain on zip folder when creating the staging area. Most of the problems are coming from here. Keep there only the required ZIP on zip folder - that can lead you to installation issues  - check My Oracle Support Doc ID 1588372.1
    • Do Include
    • V35803-01 - applTOP 
    • V35804-01 - applTOP CD2
    • V29764-01 - webTier utilites
    • V29856-01 - weblogic
    • V35813-01 - one-off patches
    • V35802-01 - OAS
    • V35230-01 - DB rapid Install
    • V35231 (1-5)- DB rapid install
    • V35807 - VISION DB 1
    • V35808 - VISION DB 2
    • V35809 - VISION DB 3
    • V35810 - VISION DB 4
    • V35811 - VISION DB 5
    • V35812 - VISION DB 6
    • DO NOT Include
    • V35215-01
    • V37515-01 (1-6)
    • Any other file
  • Be sure to use the latest startCD to create the staging area - on 28/02/2014 was Patch 17873425: RI STARTCD 12.2.0.47_5
  • After a failed install, to start installing clean contents of /oracle/VIS and /oracle/oraInventory

Documentation for Installation

This is the documentation that was followed to perform the installation of EBS environment.

Blogs



My Oracle Support


Doc ID 1330701.1
Doc ID 1378579.1
Doc ID 1320300.1



Environment Management


Order of StartUp of Services Should be 
First DB Listener, Database & then Application Tier Services

Order of ShutDown of Services Should be
First Application Tier Services then Database & DB Listener 

Startup

su - oravis

1-Database Startup

Database listener startup Script

cd /oracle/VIS/11.2.0/appsutil/scripts/VIS_ebsstf01
./addlnctl.sh start VIS

Database startup script

cd /oracle/VIS/11.2.0/appsutil/scripts/VIS_ebsstf01
./addbctl.sh start

2-Application Tier Startup

su - applvis

cd /oracle/VIS/fs1/inst/apps/VIS_ebsstf01/admin/scripts

./adstrtal.sh apps/apps

Shutdown

1-Application Tier Stop

su - applvis

cd /oracle/VIS/fs1/inst/apps/VIS_ebsstf01/admin/scripts

./adstpall.sh apps/apps

2-Database Stop

su - oravis

Database shutdown script

cd /oracle/VIS/11.2.0/appsutil/scripts/VIS_ebsstf01
./addbctl.sh stop

Database listener shutdown Script

cd /oracle/VIS/11.2.0/appsutil/scripts/VIS_ebsstf01
./addlnctl.sh stop VIS

My experience

Problem: 

Some exceptions that appeared during the installation,mainly during the environment health check.

RW-00048: Error: Verify that the format of the file /etc/hosts is of the form "IPAddress hostname.domainname hostname"

Solution: On the host files, be sure the file is having only on space between the ip and the host name, do not use tabs. Be sure your hostname exceeds the 30 characters.

127.0.0.1 [host name].[full domain name] [hostname]

Problem: 

Not able to run DB installer. Check staging area.

Solution: Allways check using md5sum the downloaded zips. You have the digest area one-delivery to check the md5 tokens.

Problem: 

oracle.apps.fnd.txk.config.ProcessStateException: OUI process failed : Exit=139 See log for details.

Solution: Check in this post the list of zip files that should be on the zip folder when running createStage script. Fo not maintain any zip that is not on the list in this folder or else you can have this exception.

Problem: 

Established connection with the WebLogic AdminServer.
Trying to establish connection using the AppsJDBCConnector
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=YES)(FAILOVER=YES)(ADDRESS=(PROTOCOL=tcp)(HOST=ip-10-33-203-79.eu-west-1.compute.internal)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=VIS)))
Could not obtain connection using the AppsJDBCConnectorORA-01005: null password given; logon denied

Trying to get connection using SID based connect descriptor
Database connection could not be established.
Exiting.

Solution: hostname + domain + SID is bigger than 30 characters. Change the hostname for something smaller.

BPM Workspace and Webforms customization

Overview

Under the propose of a project customization customization on BPM workspace and designed webforms were applied using custom css and used as skin and as webforms theme. Its important also to highlight that a workspace skin appliance is enough to bring customization to your webforms since they will inherit the workspace skin customization, nevertheless, themes offers you the possibility to enrich that customization or even to overlap it if desired. This blog post shares my experience trying what is available today as sample from Oracle Samples site but also how I found it starting from scratch.

I have follow the following contents to achieve a full workspace and webforms customization:


Try it !


How about trying to check one possible final result ? Try to enable the new created Skin workspace skin and new created theme !

  1. Download the provided sample file in here
  2. Extract custom.client.applib.jar from WorkspaceAndFormsCustomization\SampleSkin\SharedLib folder
  3. Deploy it via weblogic deployment as shared library
  4. Restart the applications (force stop, – Worklist (worklist-wls), Workspace(OracleBPMWorkspace) and DefaultToDoTaskFlow
  5. Go to workspace, log in as weblogic
  6. Go to Administration
  7. Choose a skin: mySkin
  8. Set branding logo to: /faces/logo.png
  9. Set branding title to: BPM Workspace or other
  10. Go to BPM Composer, login
  11. Change the theme applied on the forms to mySkin
  12. Redeploy the project
Note: Until a form is loaded for a first time the new theme will not appear on the list. So, to be able to access the webform themes you need to deploy (if there is none already deployed) a process with webforms and load a webform for the first time on your workspace. Doing that will make the theme available on webform edition back on BPM composer.

Build it !

Now, build it from scratch ! You can create your own workspace skin using Oracle ADF skin editor, apply it on workspace and all forms opened with it, and you can also change the webforms theme CSS and build your own webforms customization.

Start by downloading the latest ADF Skin Editor Application to define your custom workspace skin:
http://www.oracle.com/technetwork/developer-tools/adf/downloads/index.html
http://download.oracle.com/otn_hosted_doc/jdeveloper/111demos/ADFSkinEditor/ADFSkinEditor.html

If you have already experiences with ADF Skin Editor this will be very simple for you, if not, version 12c allows you to gain experience checking always the result of your changes on sample page. In fact, there is not much that workspace uses that you can configure visually using Skin Editor. I would say that you should focus on the headers, links and buttons behavior.

Workspace Customized Skin


  1. Create a new skin project with Skin Editor
  2. Make a new project deployment as ADF JAR Library
  3. The deploy JAR name should be allways custom.client.applib.jar
  4. Add the following META-INF/MANIFEST.MF file that must exist outside the project and be imported as append MANIFEST.MS file (get it form the sample project)
  5. Deploy via weblogic as shares lib
  6. Restart the application on weblogic deployments – Worklist (worklistApp), Workspace(OracleBPMWorkspace) and DefaultToDoTaskFlow
  7. Access the workspace as administrator and check the preferences. Change on the drop box to your customized skin.

Just as note, the content of the MANIFEST.MF file should be:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 19.1-b02 (Sun Microsystems Inc.)
Implementation-Vendor: Oracle
Implementation-Title: Custom Client Applib
Implementation-Version: 1.0
Product-Name: Custom Client Applib
Product-Version: 11.1.1.4.0
Specification-Version: 1.0
Extension-Name: custom.client.applib

Note: Due to dependencies, to update the custom.client.applib.jar you will need to undeploy OracleBPMWorkspace, worklistApp and DefaultToDoTaskFlow. No worries, you can do it and deploy them again because the EAR file is available on [fmw_home]/Oracle_SOA1/soa/applications.

Webforms Customization


From the moment you apply a new workspace skin it will be applied to your webforms. Nevertheless, you can perform customization at webforms level creating a new theme to be applied on webforms design time. These themes are defined changing CSSs files and making available new themes part of custom.client.applib.jar file. Images can also be deployed together with this new theme in order to make them available on your webforms.

The webforms are based in Frevvo forms, it then necessary to change this Fevvo webforms CSS to meet your look and feel requirements. The best way is to expand WorkspaceAndFormsCustomization\SampleSkin\SharedLib\custom.client.applib\themes\mySkin.zip file available on Oracle customization sample and refer to mySkin\minimal\readme.txt to know which components you should change.

If there is images that you want to include on your css, copy all images to be used to mySkin\minimal\images

After you performed all the desired changes on CSS to reflect your needs, zip them and give them a name (e.g. mySkin.zip)

Note: Remember that the extension should be zip.

Now, this must be added to to your custom.client.applib jar file. Here they are the steps to be followed:

  1. Create a folder named themes on the root of your custom.client.applib
  2. Create a zip file containing the webforms folder structure css
  3. Create a file named themes.txt inside the themes folder
  4. Fill in with the name of the webform customization zip file created on step 2
  5. Copy the folder themes to root on custom.client.applib
  6. Deploy a BPM process and run until you can open a first task on workspace. Note: until a form is loaded a first time the new theme will not appear on the list.
  7. On BPM Composer you should now be able to access the new theme on Style tab when editing a form. Changing the theme will apply the new CSS.

Resource Bundle Configurations

Workspace configuration can also be extended to provide label that refers to a key-value pair in the Resource Bundle. In this way, you can internationalize your workspace title for example using LABEL_WORKLIST_TITLE key.

It is possible also customize other workspace areas like link area working also with resource bundle changes. Since I didn't explore much this area, please refer to Oracle documentation.