Kavin's SOA Blog

May 14, 2009

How To Control The Size Of The BPEL domain.log File

1.  Logon to your server and navigate to directory BPEL_HOME/domains/<domain name>/config.

2.  Make a backup copy of the log4j-config.xml file.

3.  Open the log4j-config.xml file for edit.

4.  Change the appender class from com.collaxa.cube.util.CXRollingFileAppender to org.apache.log4j.RollingFileAppender.

5.  Add the property MaxFileSize:

<param value="10MB" name="MaxFileSize" />

Here, a maximum file size of 10MB is specified, but you can make it whatever value suits your environment.  The top of the log4j-config.xml file now looks like:

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender class="com.collaxa.cube.util.CXRollingFileAppender" name="A1">
<param value="true" name="ImmediateFlush" />
<param value="false" name="Append" />
<param value="C:/oracle/ora10g/soasuite/bpel/domains/default/logs/domain.log" name="File" />
<param value="10" name="MaxBackupIndex" />
<param value="10MB" name="MaxFileSize"/>
<layout class="org.apache.log4j.PatternLayout">

6.  Save the file, and restart the BPEL container.

Please note that these changes will be carried forward to any new domain that you create.  If you have already created domains in addition to default, you will need to change the log4j-config.xml file for each of these domains to limit the size of those log files.

April 16, 2009

Failed to lock the record, another user holds the lock.

Filed under: Configuration, Debugging — Tags: , , , , , — Kavin @ 10:48 pm

Error

JBO-26030: Failed to lock the record, another user holds the lock.
oracle.jbo.AlreadyLockedException: JBO-26030: Failed to lock the record, another user holds the lock.

Cause

Two possible causes are:

  1. transaction-config timeout is set too low
  2. connection caching is enabled

Solution

  • Increase the transaction timeout in server.xml to a large number

<transaction-config timeout="120000" />

  • Set connectionCachingEnabled  property in /j2ee/OC4J_BPEL/config/data-source.xml to false

<property name="connectionCachingEnabled" value="false"/>

March 12, 2009

Creating copy of JDeveloper BPEL Project

Filed under: Development — Tags: , , , , — Kavin @ 5:35 pm

Out of the box, JDeveloper provides couple of templates (Synch and Asynch) for developing BPEL process. However, in real world scenarios, especially within matured SOA environments, you will need to have basic standards like fault handling, notification features built in. In such a case you have a option to use “custom template” option of JDeveloper where you build a BPEL project based upon standards and then mark this project as template. Once you do so JDeveloper will give you that project as an option while selecting template for BPEL project. However this option is little bit flaky. Many times I experienced that new project doesn’t have all the artifacts. So I came up with a small ANT task which serves the purpose. You simply paste this snippet inside your build.xml which JDeveloper creates for your out of box.

<target name="copyProject">
        <property name="sourceDir" value="${basedir}"/>
        <property name="sourceProject" value="${BPELSuitcase.BPELProcess(id)}"/>
        <echo> Step 1: Set target directory and project name</echo>
            <input message="Please enter target directory:" addproperty="targetDir"/>
            <input message="Please enter project names:" addproperty="projectName"/>
            <property name="sourceWSDLNamespace" value="http://otn.oracle.com/samplenawsdlmespace"/>
            <property name="sourceSchemaNamespace" value="http://otn.oracle.com/sampleschemanamespace"/>

            <input message="Please enter target WSDL namespace:" addproperty="targetWSDLNamespace"/>
            <input message="Please enter target Schema namespace:" addproperty="targetSchemaNamespace"/>

        <property name="projectDir" value="${targetDir}/${projectName}"/>

        <echo> Step 2: Copy files from template to New Project </echo>
            <copy todir="${projectDir}" verbose="true" includeemptydirs="false"
                overwrite="false">
                <fileset dir="${sourceDir}">
                    <exclude name="**/output/**"/>
                    <exclude name="**/*.bak"/>
                </fileset>
            </copy>

        <echo> Step 3: Renaming Files </echo>
            <move file="${projectDir}/${sourceProject}.jpr"
                tofile="${projectDir}/${projectName}.jpr" verbose="true"/>
            <move file="${projectDir}/bpel/${sourceProject}.wsdl"
                tofile="${projectDir}/bpel/${projectName}.wsdl" verbose="true"/>
            <move file="${projectDir}/bpel/${sourceProject}.bpel"
                tofile="${projectDir}/bpel/${projectName}.bpel" verbose="true"/>
            <move file="${projectDir}/bpel/${sourceProject}.xsd"
                tofile="${projectDir}/bpel/${projectName}.xsd" verbose="true"/>
            <replace dir="${projectDir}" token="${sourceProject}" value="${projectName}"
                   summary="true"/>

        <echo> Step 4: Replacing Namespaces </echo>
            <replace dir="${projectDir}" token="${sourceWSDLNamespace}" value="${targetWSDLNamespace}"
                   summary="true"/>
            <replace dir="${projectDir}" token="${sourceSchemaNamespace}" value="${targetSchemaNamespace}"
                   summary="true"/>
     </target>

It simply accepts 4 parameters

  1. Target Directory – It’s the directory where your project will be places e.g. c:\projects
  2. Project Name – Name of your BPEL project, also a folder will be created under your target directory folder you mentioned above e.g. c:\projects\sampleProject1
  3. Target WSDL Namespace – This will be target namespace of WSDL in new project.
  4. Target Schema Namespace – This will be target namespace of schema in new project.

Apart from that you have two more variables which you need to set i.e.

  1. Source WSDL Namespace – WSDL target namespace of your source project.
  2. Source Schema Namespace – Schema target namespace of your source project.

Once you complete this, you can simply run that target and you are good to go.

image

March 10, 2009

Top Down web service in JDeveloper BPEL Projects

Filed under: Development — Tags: , , , , — Kavin @ 7:32 pm

Many a times its not possible to use the WSDL created by JDeveloper in BPEL project because of various reason like

  • SOA Governance standards
  • WSDL shipped by vendor or partner or third party application
  • etc.

For such reasons we have to develop our BPEL project in a slightly different way. Below I am presenting step by step guide to accomplish the above mentioned task. Hope this helps.

Select on Workspace > New Project > BPEL Process Project, click OK

image

Select Empty BPEL Process from “Template” top-down menu, Click Finish.

Please note that here I am selecting Empty BPEL process for the sake of simplicity, however you can follow pretty much the same steps in other templates (including custom templates). Idea is to create a partner like with custom WSDL and attach it with receive (or pick) activity.

image

You should now see an Empty BPEL Process with main scope and no activities

image 

Now move your mouse to “Services” swim lane and right click, Select “Create Partner Link”

image

For the test purpose, I am picking customerPartyMaster.wsdl shipped with OAGIS 9.2 model. I hosted that WSDL on web server to avoid hassles of maintaining references.

image

It will prompt you to create “Partner Link Types” section in WSDL, please select “Yes”.

imageThis will create a Ref WSDL which imports WSDL you specified and adds “Partner Link Type” section to it.

image

Now select the Partner Link Type, Partner Role and My Role.

image

Now drag “Receive” activity in your project. Point receive to “client”, this way your WSDL becomes the WSDL of your BPEL process. Select the operation you want to use for this BPEL project. If you want to make this BPEL multi-operation BPEL i.e. BPEL exposing more than one operatin, please use “Pick” activity to do so. Rest of the steps remains the same.imageClick on the “Wizard” icon to create InputVariable. It should automatically pick up data type based on the selected operation.

imageClick OK (on both create variable and Receive activity).

Now drag “Reply” activity to your project and point it to “client” partner link. Select the operation and create response variable for that.

image image

Now putting sample assign activity which maps one field of input variable to one in output variable

image

Click OK, your assign should look like this.

image

Click OK and your project should look like this

image 

This completes your BPEL process with custom WSDL. Now you should be able to deploy it and test it on BPEL server.

To test this project, would recommend using SOAP UI for testing. Testing page shipped with application is not always reliable. SOAP UI is still gold standard for me.

image

Check endpoint property for the port and operation which we used for the project

image

Create new request for the operation which we used in BPEL and pick the right endpoint location from the dropdown.

image

Prepare the request and send it to BPEL Server

image 

Response from the BPEL process.

image

This completes our exercise.

Migrating Oracle BPEL 10.1.3.3.x to different environments

Filed under: Deployment — Tags: , , , , — Kavin @ 7:27 pm
  • Initial Setup
    • Not Required. Out of the box available with SOA Setup. JDeveloper creates a build.xml under each BPEL project which you create. Simply need to alter build.xml to make it suitable for migration across different environments.
  • Project Setup
    • Create a copy of build.properties (with the names mentioned below) file for each environment and save it at the same location as build.properties (it’s generally located at the root folder of JDeveloper project)
      • build_dev.properties
      • build_tst.properties
      • build_prd.properties
      • build_prf.properties
  • As of now assumption is we have Development (dev), prf (performance), tst (test) and Production (prd) environments.
  • Make the following changes into build_<env>.properties

    ############### Add (Mandotory) ###############
    # Application specific variables to be used during the build
    bpel_host= <bpel server VIP name> ## (put the host name which will be substituted in WSDL URLs in respective environments)
    bpel_port=<bpel server VIP port>
    ############### Update (Mandatory) ###############
    # Make sure admin.user, admin.password is correct for appserver
    admin.user = oc4jadmin ## or the user name who has access to BPELAdmin console)
    # http.hostname and http.port should point to BPEL Server’s host and http port
    http.hostname = <hostname> ## hostname of the server where we are deploying
    http.port = <port> ## port where server is running
    # Change below if deploying in domain other than "default"
    domain = <bpel domain>
    # Change below if deploying with process revision other than 1.0
    rev = <current revision>
    ############### Update (Mandatory for Clustered Environment) ###############
    cluster = true
    j2ee.hostname = <physical node where bpel process will be deployed>

  • Copy build.xml at <app root> to bpel subfolder
    • copy <app root folder>\build.xml <app root folder>\bpel\build.xml
  • Make the following changes into <app root folder>\bpel\build.xml
    • Add <customize> task under bpelc task

      <target name="compile">
      <echo>
      ————————————————————–
      | Compiling bpel process ${process.name}, revision ${rev}
      ————————————————————–
      </echo>

      <bpelc input="${process.dir}/bpel/bpel.xml" out="${process.dir}/output"
      rev="${rev}" home="${bpel.home}"/>
      </target>

      ############### Change it to the following ###############
      ## You have to put <partnerLinkBinding> tag for each partner link to be modified
      ## below is illustration for SampleProcess defined in bpel.xml as sample_pl we have to do similar
      ## task for other processes

      <target name="compile">
      <echo>
      ————————————————————–
      | Compiling bpel process ${process.name}, revision ${rev}
      ————————————————————–
      </echo>

      <bpelc input="${process.dir}/bpel/bpel.xml" out="${process.dir}/output"
      rev="${rev}" home="${bpel.home}">
      <customize>
      <partnerLinkBinding name="sample_pl">
      <property name="wsdlLocation">
      http://${bpel_host}:${bpel_port}/orabpel/${domain}/SampleProcess/{rev}/SampleProcess?wsdl
      </property>
      </partnerLinkBinding>
      <configurations>
      <property name="propName">propValue</property>
      </configurations>
      <activationAgents name="actAgentName">
      <property name="propName">propValue</property>
      </activationAgents>
      <preferences>
      <property name="propName">propValue</property>
      </preferences>
      </customize>
      </bpelc>
      </target>

    • If you have to make changes into other files apart from bpel.xml like WSDLs or XSDs or XSLs please use "replace" ant task. Insert this text inside "compile" target before <bpelc> tag.

      <replace file="<fileName>" token="<searchText>" value="<replaceText>"/>
      For example:
      <replace file="sample.wsdl" token="search_text" value="${replace_text}"/>

    • Refer to the environment specific build_<env>.properties file

      <!– First override from build.properties in process.dir, if available –>
      <property file="${process.dir}/build.properties"/>
      ############### Change it to the following ###############
      <!– First override from build.properties in process.dir, if available –>
      <property file="${process.dir}/build_${env}.properties"/>

  • Make the following changes into build.xml (at application root folder).
    • Create a new compile target that redirects execution to the target within the build file within the bpel subdirectory

      <target name="compileEnv">
      <echo>
      ————————————————————–
      | Compiling bpel process using ${process.name}/bpel/build.xml
      ————————————————————–
      </echo>
      <ant dir="${process.dir}/bpel"/>
      </target>

    • Modify the process-deploy target to invoke this new compile target

      <target name="process-deploy"
      depends="validateTask, compile, deployProcess, deployTaskForm, deployDecisionServices" />
      ############### Change it to the following ###############
      <target name="process-deploy"
      depends="validateTask, compileEnv, deployProcess, deployTaskForm, deployDecisionServices" />

    • Refer to the environment specific build_<env>.properties file

      <!– First override from build.properties in process.dir, if available –>
      <property file="${process.dir}/build.properties"/>
      ############### Change it to the following ###############
      <!– First override from build.properties in process.dir, if available –>
      <property file="${process.dir}/build_${env}.properties"/>

  • Deployment
    • Upload your Project to build server under deployment folder for example: /apps/orabpel/deploy/<env>/<domain>/<app>.
    • Start BPEL Developer Prompt / Shell
      • <ORACLE_HOME>/bpel/bin/devprompt.sh
    • Go to the application folder
      • cd /apps/orabpel/deploy/<env>/<domain>/<app> folder (as mentioned in step 01)
    • Execute obant.sh from your <app root folder> and pass appropriate values depending upon the environment you want to deploy
      • obant.sh -Denv=dev -Dadmin.password=<oc4jadmin password> or
      • obant.sh -Denv=qa -Dadmin.password=< oc4jadmin password > or
      • obant.sh -Denv=test-Dadmin.password=< oc4jadmin password > or
      • obant.sh -Denv=prod -Dadmin.password=< oc4jadmin password >
  • Validation Step
    • Obant script should say "Build Successful" i`n the end. Also test deployment from BPEL Console.

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.