Tuesday, April 17, 2012

BPEL ora:countNodes() XPath function usage

Occasionally I have hit the problem where BPEL engine fails to execute the countNodes() function reporting the following error;

javax.xml.xpath.XPathExpressionException: Failed to execute countNodes() function : oracle.xml.parser.v2.XMLNodeList
        at oracle.xml.xpath.JXPathExpression.evaluate(JXPathExpression.java:242)
        at com.collaxa.cube.xml.xpath.BPELXPathUtil.evaluate(BPELXPathUtil.java:247)

Since the BPEL XPath expression builder allows declarative development, it is very tempting and easy to pick the relevant function and insert the BPEL variable from the panels for evaluation. However, for a function such as ora:countNodes(), the catch is that it doesn't expect bpws:getVariableData(blah blah blah) as an argument. Rather, the XPath expression of the variable has to be directly fed into it for proper evaluation.

Apparently, the BPEL XPath function documentation for ora:countNodes() states the following definition;

 ora:countNodes(variableName, partName?, locationPath?)

Hence,  ora:countNodes(bpws:getVariableData(variableName, partName?, locationPath?)) will eventually throw the above error. It is a very simple thing, but can easily miss the unsuspecting eyes :)

Thursday, April 12, 2012

SOA Suite 11.1.1.6 (PS5) Released !!

The Oracle SOA Suite 11.1.1.6 (PS5) is now generally available and the binaries can be downloaded from the OTN.

This release is promising and has provided better features in comparison to the previous PS4 release. Listed below are a few cool features which I found really helpful and see here for the complete list of new features available in this release.

BPEL:
  • New delivery/persistence policy for BPEL processes (aysnc.persist, async.cache & sync)
  • Similar to the 'Skip Condition's that we were used to in the BPM user assignments, skip conditions through XPath queries make way to skip activity executions in BPEL processes which can largely remove 'switch-case' design in most scenarios
  • Assertions are enabled in the request-response activities such as receive, invoke, reply etc.. where XPath conditions can be asserted to throw faults when they fail. These can be asserted before/after invocation namely pre-assert and post-assert
Human Task:
  • With regards to human-task, the much awaited feature of dynamic-assignment & task escalation can now be performed from the user task UI as provision is enabled for exposing this dialog in the user interface
Business Rules:
  • Business Rules now add capability to define rules in normal programming paradigm if-then-else, elseif, do-while, while etc.. which are greatly expected. This comes in as a great boon as earlier releases didn't offer users to define else conditions which had to be handled tactically using 'if' ONLY conditions which was a challenge in many complex scenarios
  • Usability and performance has greatly improved for editing business rules from within the composer
Business Activity Monitoring (BAM):
  • BAM is now supported on IBM Websphere
  • BAM reports based on external data objects can now be refreshed via Timer which removes the need for reload of entire report/view
  • During B2B-BAM integration scenarios we are often faced with error handling challenges at the EMS (Enterprise Messaging Service) layer which is now offered as part of this release
DB, File/FTP Adapters:
  • Optimizations for DB and File/FTP adapters such as coherence integration claims to improve the performance greatly especially during large payload interactions
Enterprise Manager (EM):
  • Alerts are displayed in the EM console for messages that are stuck in asynchronous transactions which can be recovered from within the console
  • Enhanced composite instance search provided for better search and usability for IT administrators

Wednesday, April 11, 2012

Oracle B2B Inbound Outbound Testing

I just thought that I would note down the steps for performing the B2B inbound and outbound transaction testing using the Oracle B2B gateway.

For inbound transactions, perform the following;

1. Create a host trading partner
2. Create a external trading partner
3. Go to Administration and create a listening channel - Note that the listening channel configured here (For example a folder in the file system) is meant for inbound transactions where Oracle B2B would listen and pickup the files
4. Create a trading partner agreement at the external trading partner level by providing the document definition and channel details
5. After all these configurations, place a file (valid against the document definition) on the listening channel which would be picked up by the B2B engine and would be sent to the trading partner (depending on the contract established under the trading partner agreement) on appropriate channel. Important to note here that the file should have the following naming convention;

<fromtradingpartner>_<uniquenumber/timestamp>.<anyfileextn>

For testing outbound transactions;

1. Configure the channel details under the trading partner level (Channel tab). This would be the channel where the resulting file would be sent/written to
2. Disable the 'Translate' option under the trading partner agreement as we are not intending to translate the format of the file for simulating/testing outbound transactions. This option can be enabled if we are processing the file contents through the SOA layer
3. Go to Administration -> Listening Channel -> create a separate listening channel where you want the file to be read for outbound and check the 'Internal' option under the 'Channel Attributes' section - This will ensure and notify B2B gateway that the channel is configured for outbound transactions
4. Ensure that the file naming conventions for testing outbound transactions are as follows;

<totradingpartner>_<doctype>_<doctyperevision>_<msgtype>_<msgid>.<anyfileextn>

5. Now, place the sample file with the above naming conventions on the listening channel configured above (step 3) which would simulate the outbound transactions and write/send the file to the trading partner channel


Tuesday, March 27, 2012

BPM 11g User Task (worklist) UI hostname config

Sometimes when you deploy the BPM 11g process along with the associated ADF UI projects, you could notice that the ADF task forms when accessed at run-time pickup the hostname by default that is configured during the SOA install. At times this hostname need not be the desired one to use and an alias hostname would be preffered. To resolve this issue, there are two options;

1. Login to EM console -> Choose the BPM process -> Scroll down to the 'Component Metrics' section -> Click on the appropriate user tasks -> update the hostname -> Apply.

2. In JDeveloper, open the ADF UI project and update the hostname, port under the hwtaskflow.xml file (This file is available under the 'Application Sources' section.

If you want to carry forward same hostname across environments go for the second approach as it overrides the default hostname during deployment stage.

Friday, February 24, 2012

Oracle B2B 11g java.lang.UnsatisfiedLinkError

I hit this error recently while trying to send an EDI data through my B2B gateway and lost my way as couple of re-installs from scratch didn't really helped either. All the help from different forums and blogs pointed basically to 4 causes for this error as cited below; Note that my environment is Windows 7 64-bit with SOA 11.1.1.5 (latest as on the date of writing).

1. Installing 32-bit installables of SOA suite/WebLogic on a 64-bit environment
2. Installed 64-bit installables of SOA/WebLogic on a 32-bit JDK
3. Corrupt Edifecs or XEngine files
4. Permissions issue on the XEngine folder/libraries

If your case falls in one of the aforesaid cases, then don't read further as you will have to rectify them which could well solve the issue in first place.

In my case, neither of the above were the actual causes as I got my environments and installs perfectly having done several middleware product installs on various environments myself !!! However, this error simply defied all logic and intuition. Detailed error message below;

<Error> <oracle.soa.b2b.engine> <BEA-000000> <java.lang.UnsatisfiedLinkError: com.edifecs.xengine.xeobjects.XEHelper.createSourceFromStreamNative(Ljava/lang/String;Ljava/io/InputStream;)Lcom/edifecs/xengine/xeobjects/XESource;       
        at com.edifecs.xengine.xeobjects.XEHelper.createSourceFromStreamNative(Native Method)
        at com.edifecs.xengine.xeobjects.XEHelper.createSourceFromStream(Unknown Source)
........................................
........................................
at oracle.tip.b2b.engine.ThreadWorkExecutor.run(ThreadWorkExecutor.java:234)
        at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:120)
        at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:183)
        at weblogic.work.DaemonWorkThread.run(DaemonWorkThread.java:30)
>

Then I started my traditional Google search in a slightly different fashion trying to identify the generic root cause of this exception. After all this is a JAVA error which is reported during the EDI processing by the B2B gateway.

At this juncture it would be good to understand the cause for "java.lang.UnsatisfiedLinkError"; As per Java Docs this error is "Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native". Now, this much of help is great to identify and resolve the issue (at least in this particular case ;)

As a matter of fact, XEngine library files are located in <MiddlewareHome>\Oracle_SOA1\soa\thirdparty\edifecs\XEngine\bin. I also noticed the following message in the WebLogic console during my server startup which explained the rest.

XEngine may not be installed properly. If you plan to use EDI/HL7 that requires XEngine, please unzip the XEngine bundle to install XEngine manually in $ORACLE_HOME/soa/thirdparty/edifecs directory

Yes, the library files are intact and are present in the specified location (uncorrupted !). It is just that WebLogic could not load the XEngine libraries. Now, there is one way to explicitly make WebLogic load these libraries;

If you are on Windows, set -Djava.library.path=<MiddlewareHome>\Oracle_SOA1\soa\thirdparty\edifecs\XEngine\bin
On Linux, set LD_LIBRARY_PATH=<MiddlewareHome>/Oracle_SOA1/soa/thirdparty/edifecs/XEngine/bin

Doing this explicitly in setSOADomainEnv.cmd or setSOADomainEnv.sh will ensure that WebLogic loads these libraries during server startup and voila we got rid of the spunky error.

Ah.. Finally do let me know if this helped you :)

Sunday, February 12, 2012

SOA 11g DB Sequence Reset Issue

Ever wondered why the primary key sequence is reset while using a DB adapter to insert records from your SOA application?

The issue is that the DB adapter pre-allocates sequence values based on the value configured in the DB Adapter's outbound connection pool.

To overcome this issue, ensure that the "sequencePreallocationSize" property value matches the value that was specified for sequence increment in DB during sequence creation. For example 1.


BPM 11g BAM Data Object not created automagically

Have you ever faced a situation where the BAM DO was not getting created automagically when you deploy and run your BPM 11g (In this case I am using BPM 11.1.1.5 with FP) process as expected? Here are the list of checks that you must make to ensure that everything was setup as documented.

1. Ensure that the BAM deployment configurations are done in Oracle WebLogic Console (Go to Deployments -> BAM Adapter -> Configurations -> Outbound Connection Pool and provide the BAM connection details for eis/bam/soap and update the deployment plan)

2. Go to Oracle WebLogic EM console, ensure that the 'Disable Actions' property is empty (By default, this property will hold a value as 'BAMCommand') under the soa-infra domain 'System MBean Browser'

3. Ensure that the 'Enable BAM' option is selected. Go to 'BPM Project Navigator', right click on the process -> Project Preferences -> Select 'Enable BAM' option. Also ensure that the BAM Adapter JNDI is provided as configured in the deployments (refer step 1 above). By default the JNDI is eis/bam/soap. Leave the Data Object location to Samples/Monitor Express which would the default location where the BAM DO will be created 'automagically'


4. Ensure at least one business indicator (dimension) must have been created in the BPM process for which you would ideally pass/set values from within multiple stages in your process so that the runtime data is sent to BAM real-time

5. Before deploying the BPM process (after enabling BAM), ensure that any previous versions of the process are undeployed from Oracle WebLogic server

6. DO NOT execute the setup.bat or setup.sh script available under /Oracle_SOA1/bam/samples/bam/monitorexpress/bin

I have noticed that this had caused the following error while BAM tries to create the data object dynamically (version 11.1.1.5 with FP). On closer observation of the bam server diagnostic logs the following error is sighted which in itself is not very intuitive to fix as it complains of constraint violation in orabam MDS database during the creation of the BPM BAM DO.

Exception: oracle.bam.adc.common.exceptions.UniqueConstraintViolationException: BAM-01273: Active Data Cache unique constraint violation
  at oracle.bam.adc.dse.oracle.OracleExceptionHelpers.getStorageException(OracleExceptionHelpers.java:134)
  at oracle.bam.adc.dse.oracle.OracleStorageEngine.insertDataSetRow(OracleStorageEngine.java:1216)
  at oracle.bam.adc.kernel.datasets.DatasetBase.insertRowInternal(DatasetBase.java:630)
  at oracle.bam.adc.kernel.datasets.DatasetBase.insertRow(DatasetBase.java:592)
  at oracle.bam.adc.kernel.datasets.SystemDataset.insertRowInternal(SystemDataset.java:172)
..
..
..
Caused by: java.sql.SQLIntegrityConstraintViolationException: SQLError(1) SQLState(23000) ORA-00001: unique constraint (DEV_ORABAM.SYS_C007296) violated

In order to fix this issue, do the following;
Go to BAM console -> Active Studio -> Delete the following reports pertaining to BAM monitor express
  • Monitor Express Dashboard
  • Monitor Express Summary
  • Monitor Process Details
  • Fault Report

Go to BAM Console -> Architect -> Delete the following Data Objects pertaining to BAM monitor express in the order specified below;
  • INTERVAL
  • COUNTER
  • COMPONENT

7. Undeploy existing process composite if any

8. Restart your servers

9. Deploy the BPM process

10. Trigger an instance. Voila!! the BAM Data Object should have got created in your BAM console

11. Now, play around with the BAM DO and build your custom real-time dashboard reports