Showing posts with label BPEL. Show all posts
Showing posts with label BPEL. Show all posts

Thursday, February 28, 2013

States meaning for Instances

This is an enhanced version of my own blog dated 08-Aug-2008, BPEL: Purging Instances-1, which suggests about various States stored in Dehydration store. Earlier information was for SOA 10g interface States stored in Cube_instances, This blog is about the same but for SOA 11g.

Problem: To know the meaning of States stored under CUBE_INSTANCE table of SOA_INFRA Schema

Explanation:

Value: 0
Meaning: Initiated
Description: for an instance that has just been newly created

Value: 1
Meaning: Open & Running
Description: for an instance that has been created and has active activities executing

Value: 2
Meaning: Open & Suspended
Description: for an instance that is unavailable & is in suspended state. No action can be taken for this instance until the instance has returned to the running state

Value: 3
Meaning: Open & Faulted
Description: for an instance that has an activity that has thrown an exception. When an activity throws an exception, the instance is flagged as being in an exception state until the exception is properly caught and handled

Value: 4
Meaning: Open & Pending
Description: for an instance that is in mid of cancellation. An instance is said to be pending cancellation state - it may happen that the process is quite big & complicated that the entire cancellation process may takes anywhere from seconds/minutes/days. An instance may not be acted upon during this time

Value: 5
Meaning: Closed & Completed
Description: for an instance that has been completed i.e. All activities belonging to this instance have also been completed

Value: 6
Meaning: Closed & Faulted
Description: for an instance that has an activity that has thrown an exception while the instance is being cancelled

Value: 7
Meaning: Closed & Cancelled
Description: for an instance that has been cancelled. All activities belonging to this instance have also been cancelled

Value: 8
Meaning: Closed & Aborted
Description: for an instance that has been aborted due to administrative control. All activities belonging to this instance are also moved to the aborted state

Value: 9
Meaning: Closed & Stale
Description: for an instance who's process has been changed since the process was last accessed. No actions may be performed on the instance. All activities that belong to this instance are also moved to the stale state

Value: 10
Meaning: Non Recoverable
Description: for an instance that has failed and is marked as non recoverable

Sunday, January 16, 2011

Handling Large Payload Files

Problem:
Want to create a BPEL process to read, transform and translate a large payload file (e.g. size 1GB)?

Thoughts:
Reading and traversing large payload file was always a problem in SOA 10g. Supposedly Maximum limit for such operations are for less than 7MB files in 10g.
Solution to such problems are answered in 11g where you can read and transform huge payload files.

Solution:
Suppose you have a CSV file incoming from source directory which you want to transform to a Fixed length file. Keep the source and the destination schema (XSD) ready. Also prepare the Transformation file (XSL) and keep it handy.
For accomplishing this, you will only be using one File Adapter which will take care of your read, transform and write - so all the three operations takes place under single I/O interaction.

Follow the steps below for making it possible:
1) Drag and drop a file adapter in the external references swim lane. (For e.g. Give name as FileMove.)
2) Select Synchronous File Read
3) Give any dummy value for File physical path and File Name. It will be changed manually later.
4) Select Native format translation is not required (Opaque Schema)
5) Outbound File Adapter is now configured, click on Finish
6) Open the relevant .jca file (in this case FileMove_file.jca)
7) Ensure that className should be
"oracle.tip.adapter.file.outbound.FileIoInteractionSpec"
8) Add extra parameters as shown in below file:
<adapter-config name="FileMove" adapter="File Adapter"
xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
<connection-factory location="eis/FileAdapter" adapterRef=""/>
<endpoint-interaction portType="FileMove_ptt" operation="FileMove">
<interaction-spec
className="oracle.tip.adapter.file.outbound.FileIoInteractionSpec">
<property name="SourcePhysicalDirectory" value="testDir1"/>
<property name="SourceFileName" value="test1"/>
<property name="SourceSchema" value="xsd/source-csv.xsd"/>
<property name="SourceSchemaRoot value="Root-Element"/>
<property name="SourceType" value="native"/>
<property name="TargetPhysicalDirectory" value="testDir2"/>
<property name="TargetFileName" value="test2"/>
<property name="TargetSchema" value="xsd/destination-fixedLength.xsd"/>
<property name="TargetSchemaRoot value="Root-Element"/>
<property name="TargetType" value="native"/>
<property name="Xsl value="xsl/SourceToDestination.xsl"/>
<property name="Type" value="MOVE"/>
</interaction-spec>
</endpoint-interaction>
</adapter-config>
9) Save the file and deploy the process.

Note:
This will works only if all the records in the data file are of the same type.

Monday, January 3, 2011

ORABPEL Spying-Part2

Requirement:
To get all BPEL instances and their duration that run longer than 'n' seconds

Solution:
SELECT
process_id, creation_date,
SUBSTR(modify_date-creation_date,12) Duration,
SUBSTR(REGEXP_SUBSTR(title, '[^ ]+', 1, 2), 2) InstanceId
FROM
cube_instance
WHERE
TO_CHAR(creation_date, 'YYYY-MM-DD HH24') >= '<Date_value>'
AND
TO_CHAR(creation_date, 'YYYY-MM-DD HH24') <= '<Date_value>'
AND
(modify_date-creation_date) > '0 0:0:n.0'
AND
process_id IN ('<Name of Process>')
ORDER BY
modify_date DESC

Example:
Here n=45 seconds

SELECT
process_id, creation_date,
SUBSTR(modify_date-creation_date,12) Duration,
SUBSTR(REGEXP_SUBSTR(title, '[^ ]+', 1, 2), 2) InstanceId
FROM
cube_instance
WHERE
TO_CHAR(creation_date, 'YYYY-MM-DD HH24') >= '2010-10-12 15'
AND
TO_CHAR(creation_date, 'YYYY-MM-DD HH24') <= '2011-01-01 21'
AND
(modify_date-creation_date) > '0 0:0:45.0'
AND
process_id IN ('TestProjectBPEL')
ORDER BY
modify_date DESC

ORABPEL Spying-Part1

Requirement:
Want to get the information on currently running processes - Shortest and Longest running instances on server?

Solution:
Below query will give you the desired result:

SELECT * FROM (
SELECT
bpel_process_name AS "ProcessName",
TO_CHAR(MIN(creation_date),'YYYY-MM-DD HH:MI') AS "EarliestDate",
COUNT(*) AS "TotalRunningProcesses",
TO_NUMBER(SUBSTR(MIN(sysdate-creation_date), 1,
INSTR(MIN(sysdate-creation_date), ' '))) AS "ShortestRunning (Days)",
SUBSTR(MIN(sysdate-creation_date),
INSTR(min(sysdate-creation_date),' ')+1,8) AS "ShortestRunning (Hours)",
TO_NUMBER(SUBSTR(MAX(sysdate-creation_date), 1,
INSTR(MAX(sysdate-creation_date), ' '))) AS "LongestRunning (Days)",
SUBSTR(max(sysdate-creation_date),
INSTR(MAX(sysdate-creation_date),' ')+1,8) AS "LongestRunning (Hours)"
FROM ORABPEL.bpel_process_instances
WHERE state = 1
GROUP BY bpel_process_name
ORDER BY "EarliestDate" DESC
)

NOTE: Query for Oracle BPEL Process Manager 10g (10.1.3.x)

Wednesday, June 16, 2010

Timeout for Partnerlink

Problem:
How to set timeout for Partnerlink or web service in BPEL?

Solution:
Timeout property is set in bpel.xml file under PartnerLinkBinding tag. Just you need to add a property as timeout.

It is shown below as follows:(Suppose name of the web service you are using is abc)

<PartnerLinkBinding name="abc">
<property name="timeout">30</property>
<!-- other PartnerLink properties -->
</PartnerLinkBinding>

Wait wait...is it that evrything you need to do for having Timeout for Partnerlink? The answer to this is NO. This property cannot work alone. You need something more to be added to it. In order to achieve this you have to add another property called "optSoapShortcut to false" in the bpel.xml for that partner link.

Now it will look like:

<PartnerLinkBinding name="abc">
<property name="timeout">30</property>
<property name="optSoapShortcut">false</property>
<!-- other PartnerLink properties -->
</PartnerLinkBinding>

optSoapShortcut : This property instructs bpel to make the webservice calls via saop stack or not. When BPEL invokes any partner links if the services its calling is running on the same server/domain then it avoid soap overhead and calls natively. There may be situations that you want to invoke the services via Soap Stack, then this property helps you do just that.
Timeout property works on soap stack. Suppose a BPEL proces is calling another BPEL process then the call will change from Soap stack to local binding call.

Deployment with Verbose

Problem:
What is the importance of using verbose in your project?

Solution:
Verbose entry appears inside your BPEL project under build.properties file. When you add verbose=true to build.properties file then it gives us much more information regarding the compile/deploy process of SOA projects.

Just add "verbose=true" to your build.properties and deploy your process. While Deploying goto "Apache Ant" Log Window and see more information being written to the log. To accomplish this, follow below mentioned steps:

1) Goto any BPEL Project
2) Open build.properties available under Resources in your application navigator
3) Goto the bottom and add verbose=true
4) Save and Re-deploy
5) Check the Apache-Ant Log Window in your Jdeveloper.

Resetting Console login Password

Problem:
How do you change the password for BPEL Console user 'oc4jadmin'?

Solution:
Follow the below mentioned steps to accomplish this:

1) Connect to SOA Suite EM Console (Application Server Control)
2) Click on appropriate container name. (Home or oc4j_soa, depending upon where your BPEL is available)
3) Click on Administration tab
4) Then click and Goto Task icon for Security Providers task
5) Click Instance Level Security
6) Click Realms
7) Click number under Users
8) Now search for 'oc4jadmin' in list
9) Now click it to change the password for BPEL Console and you are done

ORABPEL-02182

Problem:
ORABPEL-02182

JTA transaction is not present or the transaction is not in active state.
The current JTA transaction is not present or it is not in active state when processing activity or instance "4260005-BpInv5-BpTry7.13-1". Please consult your administrator regarding this error.

Some Thoughts:
You can encounter this error if response time of adapter is greater than the predefined waiting time for a BPEL instance.As a result process does not get dehydrated on time and fails by throwing this error.

Solution:
A better solution for above problem should be to increase the transaction-timeout values in order to make the BPEL instance to wait more time until a response returns from the adapter.

Following are the steps you should follow to acheive the result:

1) Stop SOA Server

1) Goto SOA_Home\j2ee\config\transaction-manager.xml, serach for transaction-timeout and set transaction-timeout for e.g. to 7200 or more (default value is 30).

2) Goto SOA_Home\j2ee\application-deployments\orabpel\ejb_ob_engine\orion-ejb-jar.xml and set all transaction-timeout to 3600 or more. The value passed here should be always less than the value which is mentioned in step 2.

3) Goto SOA_Home\bpel\domains\config\domain.xml and set syncMaxWaitTime to 240 or more. The value passed here should be always less than the value which is mentioned in step 3. (Default value is 45)

4) Start SOA server and run the process again. Process should work fine.

Importing libraries for using Java Exec

Problem:
Want to use Java Exec, is it resulting in error?

Solution:
Add following libraries to your .bpel code:
<bpelx:exec import="java.util.*"/>
<bpelx:exec import="java.lang.*"/>
<bpelx:exec import="java.math.*"/>
<bpelx:exec import="java.io.*"/>
<bpelx:exec import="com.collaxa.common.util.Base64Decoder"/>
<bpelx:exec import="com.collaxa.common.util.Base64Encoder"/>

Monday, March 29, 2010

Email to multiple Recipients

Problem:
Sending Email from BPEL to multiple recipients

Solution
It might just be the smallest topic I have ever blogged about, just thought to share it with you all.
EmailPayload of the Notification Service takes a String. If that String contains a comma separated list of email-addresses, it will send emails to each of the adresses in that list.
For example:
To: abhi@xyz.com,abhishek@abc.com

Friday, January 8, 2010

BPEL:Cannot find partnerLinkType 2

Problem:
Cannot find partnerLinkType 2.
PartnerLinkType "{http://xmlns.oracle.com/pcbpel/adapter/ftp/pl_get/}Get_plt" is not found in WSDL.
Please make sure the partnerLinkType is defined in the WSDL.

Solution:
If you get such kind of error while deploying project, the simple solution is to clear the WSDL Cache in the BPEL console.
Step to reach there:
1) Login to Oracle BPEL Console (for 10.1.3.4)
2) Goto Administration Tab -> Click on Actions tab
3) Click on Clear WSDL Cache.
4) Try deploying project.

Wednesday, December 30, 2009

ORABPEL-05250

Problem:
BUILD FAILED
D:\Abhi\RatingCheck\build.xml:79: A problem occured while connecting to server "localhost" using port "80": bpel_RatingCheck_v2009_12_12__74238.jar failed to deploy. Exception message is: Error deploying BPEL suitcase.
An error occurred while attempting to deploy the BPEL suitcase file "D:\oracle\product\soa\bpel\domains\default\tmp\bpel_12757142.tmp"; the exception reported is: archive cannot rename D:\oracle\product\soa\bpel\domains\default\tmp\.bpel_RatingCheck_v2009_12_12__74238_a4ef0434bf12f22a3374aab6a0a942a1

If you check the server log file - domain.log, you will see ORABPEL-05250 error.

Thoughts:
This error is encountered with SOA 10.1.3.5. You will see this error once you try to redeploy your project on the server i.e. whenever a BPEL process is already deployed on the server and you are trying to replace it with newer version or trying to deploy over it. Even in Jdeveloper you will not see the small version window poping up when you try to deploy the project.

But why this problem is there?
Possibly there is a bug with this SOA version. I think whenever we try to redeploy the project it tries to rename the existing project before replacing it with the new one. Some unknown Java process within the BPEL server locks the bpelclasses.jar file and one of your project WSDLs preventing the renaming of the parent directory.

Solution:
Possible solution (as we are doing for our projects)for this error is:
1) Undeploy the process from the console
2) Shutdown SOA Suite Server
3) Bring the Server up. (This will release the process lock).
4) Try to deploy the project.

I know this is quite painful during development. One more pain is that you cannot have multiple versions of your project on console. That means if you want to refer any instance after redeploying, forget it.

So according to me, avoid applying Patch Set 10.1.3.5 on Windows (I have not tried this on other OS). I hope Oracle will look into this matter soon.

Wednesday, December 23, 2009

ORABPEL-04077

Problem:
ORABPEL-04077
Cannot fetch a datasource connection.
The process domain was unable to establish a connection with the datasource with the connection URL "jdbc/BPELServerDataSource". The exception reported is: javax.resource.ResourceException: RollbackException: Transaction has been marked for rollback: Timed out

Thoughts:
Sometimes deploying a bpel project of bigger size using JDeveloper throws exception: javax.resource.ResourceException: RollbackException: Transaction has been marked for rollback: Timed out. This is due to the fact that JDeveloper takes too much time and fails to deploy the project.

Solution:
To solve the issue we need to change values of some configuration files of SOA Server. Follow the below mentioned steps:

1) Stop the SOA Server

2) Open the transaction-manager.xml file present under location:-
<SOA_HOME>\j2ee\oc4j_soa\config\transaction-manager.xml

3) Change the transaction-timeout attribute value to some higher value, viz. transaction-timeout="7200"

4) Now open the orion-ejb-jar.xml file present under location:-
<SOA_HOME>\j2ee\oc4j_soa\application-deployments\orabpel\ejb_ob_engine\orion-ejb-jar.xml

5) Change the transaction-timeout attribute to some higher value, viz. transaction-timeout="3600"

6)There will be 6 entries of transaction-timeout attributes in the file. You have to change all the 6 attributes.

7) Save the files.

8) Restart the SOA Server.

9) Now try to deploy the BPEL project using JDeveloper. It should work.

Monday, November 9, 2009

com.oracle.bpel.client.delivery.ReceiveTimeOutException

Problem:
nested exception is:
com.oracle.bpel.client.delivery.ReceiveTimeOutException: Waiting for response has timed out. The conversation id is bpel://localhost/default/HelloWorld~1.0. Please check the process instance for detail.

Thoughts:
Above mentioned error come if the "syncMaxWaitTime" setting is set too low. So the processes which exceeds this limit get this error.

"syncMaxWaitTime" is the delivery result receiver maximum wait time. It is the maximum time the process result receiver will wait for a result before returning. The default is 45 seconds.

Solution:
"syncMaxWaitTime" can be updated via BPEL Control:
1) Log on to the BPEL console.
2) Click on Manage BPEL Domain.
3) Click on Configuration.
4) Edit the syncMaxWaitTime setting. For long running processes, this can be increased to 1800.

You can also modify this by navigating on SOA Server for this location:
<SOA_HOME>/bpel/domains/default/config/domain.xml.

First stop the SOA Server. Now goto the above mentioned location and search for . Edit the attribute by increasing the time. Now restart the SOA Server.

Cheers...

Thursday, July 23, 2009

BPEL:rejectedMessageHandlers

Problem:
Files which do not adhere to the input file schemas should be rejected or moved to specified folder other than archive folder.

Solution:
For this we need to make an empty project which will be initiated by a file. We need to use a Read File Adapter. After the Adapter is configured and connected to a Receive activity, a bpel.xml file will be generated.
A property called ‘rejectedMessageHandlers’ is used and set in the bpel.xml file under <activationAgent> element.

Sample code for this should look like:
<activationAgents>
<activationAgent className="oracle.tip.adapter.fw.agent.jca.JCAActivationAgent" partnerLink="Read_File">
<property name="portType">Read_ptt
<property name="rejectedMessageHandlers">file://C:\SOADir\reject
</activationAgent>
</activationAgents>

Here,
C:\SOADir\reject is my directory where I want my rejected files to come.

Note: If at anytime you try to refresh anything in the BPEL project, this property gets omitted automatically. So be sure to add it again in bpel.xml file if you are refreshing any compomnent in the project.

Tuesday, May 19, 2009

BPEL: Insert huge data in DB

Problem:
To store large objects in database tables. If data is more than 32766 bytes, the DB Adapter doesnot insert the data. The Oracle BPEL PM throws following exception:
"
java.sql.SQLException: setString can only process strings of less than 32766 chararacters
Internal Exception: java.sql.SQLException: setString can only process strings of less than 32766 chararacters
Error Code: 17157 when trying to insert record in clob type of size more then 32766 characters
"
Note:- To store large data, the column in the oracle database should be of CLOB datatype which can store data.

Solution:
1) Goto location <SOA_Home>\j2ee\<ContainerName>\connectors\DbAdapter\META-INF
2) Open file ra.xml file
3) Copy and paste the below mentioned content:

<config-property>
<config-property-name>usesStreamsForBinding</config-property-name>
<config-property-type>java.lang.Boolean</config-property-type>
<config-property-value>true</config-property-value>
</config-property>
<config-property>
<config-property-name>usesStringBinding</config-property-name>
<config-property-type>java.lang.Boolean</config-property-type>
<config-property-value>true</config-property-value>
</config-property>

4) Now Goto <SOA_Home>\j2ee\<ContainerName>\application-deployments\default\DbAdapter\oc4j-ra.xml
5) Open oc4j-ra.xml file
6) Copy and paste the above mentioned properties in the connector-factory of the DB Adapter.

<connector-factory location="eis/DB/TestDB" name="TestDatabase Adapter">
<config-property value="jdbc/DBConnection" name="xADataSourceName">
<config-property value="" name="dataSourceName">
<config-property value="oracle.toplink.platform.database.Oracle9Platform" name="platformClassName">
<config-property value="true" name="usesNativeSequencing">
<config-property value="50" name="sequencePreallocationSize">
<config-property value="false" name="defaultNChar">
<config-property value="true" name="usesBatchWriting">
<config-property value="true" name="usesStreamsForBinding">
<config-property value="true" name="usesStringBinding">

<connection-pooling use="none"></connection-pooling>
<security-config use="none"></security-config>
</connector-factory>

7) Restart Oracle SOA Suite and you are done.

Thursday, April 30, 2009

Error: XPATH returns zero node

Problem:
Sometimes you get following runtime error message in your BPEL Console for the transform activity;

XPath query string returns zero node.
According to BPEL4WS spec 1.1 section 14.3, The assign activity part query should not return zero node.
Please check the BPEL source at line number "211" and verify the part xpath query.
Possible reasons behind this problems are: some xml elements/attributes are optional or the xml data is invalid according to XML Schema.
To verify whether XML data received by a process is valid, user can turn on validateXML switch at the domain
administration page.

Solution:
The probable reason for getting this error is due to assigning value to an element using Assign activity just after the Transform activity, for which the same element is not mapped in transformation. Assign activity attempts to update an element not being transformed in Transform (the element without any value).

Following steps should be done to overcome this problem:

1) Goto the transfomation mapper file
2) Right-click on the element that the Assign activity in going to use for assigning value in the next step
3) Select Set Text
4) Set any temporary value there. This will be overwritten by the Assign activity in the next step anyways.

Wednesday, April 29, 2009

Error in getting File from FTP

Problem:
Sometimes when you try to GET(Read) a pdf file from the FTP folder(using FTP adapter) in the bpel process, you get following error:

FTP Command: RETR, reply:
550 RETR Error: IFS-32615: "/TestFolder/Read/demo.pdf": Path is invalid.
Unable to get Binary file '/TestFolder/Read/demo.pdf' ; FTP command RETR returned unexpected reply code : 550

Solution:
1) Goto the following SOA Server location:
<SOA_HOME>\j2ee\oc4j_soa\application-deployments\default\FtpAdapter
2) Open oc4j-ra.xml file in Notepad.
3) Navigate to
4) Change value="" to value="UTF-8"
5) Save the file
6) Bounce the SOA Server.

Creating Database JNDI w/o EM

Problem:
Create JNDI without using Oracle Application Enterprise Manager

Solution:
While you create Database JNDI using Oracle Application Enterprise Manager, it modifies two files in the SOA installed location.

1) data-sources.xml
2) oc4j-ra.xml

We can manually create JNDIs by adding contents to these files. This try was made just to make sure that JNDIs can be created without the help of Enterprise manager.
So here you go,

1) First you need to modify the data-sources.xml file located at <SOA_Home>\j2ee\<Active container name>\config. Open the file in notepad. Add your new pool information as:

<connection-pool name="TestPOOL">
<connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="database username" password="database password" url="jdbc:oracle:thin:@//host name:port/service name" commit-record-table-name=""/>
</connection-pool>

Give a pool name. You need to provide the database connection details such as username, password, host name, port, service name. Save the changes.

2) As the second step, you need to modify the oc4j-ra.xml file located at <SOA_Home>\j2ee\<Active container name>\application-deployments\default\DbAdapter. Open the file in notepad. Add your new JNDI information as:

<connector-factory location="eis/DB/Test" connector-name="Test DB Adapter JNDI">
<config-property name="xADataSourceName" value="jdbc/Test"/>
<config-property name="dataSourceName" value=""/>
<config-property name="platformClassName" value="oracle.toplink.platform.database.Oracle9Platform"/>
<config-property name="usesNativeSequencing" value="true"/>
<config-property name="sequencePreallocationSize" value="50"/>
<config-property name="defaultNChar" value="false"/>
<config-property name="usesBatchWriting" value="true"/>
<connection-pooling use="none">
</connection-pooling>
<security-config use="none">
</security-config>
</connector-factory>

Provide the JNDI location and also the datasource name. Save the changes.

After the changes bounce the SOA Server. Now your database JNDI is ready to use.

BPEL: Default Input to initiate

Problem:
Need to pass same value everytime to initiate BPEL process(Synchronous or Asynchronous).

Solution:
If you want to pass a default input in your BPEL process while initiating process then you need to modify/add some code in your projects bpel.xml file.

Add the following code after the <partnerLinkBindings> tag in bpel.xml file:

<configurations>
<property name="defaultInput">Hi to SOA World</property>
</configurations>