Tuesday, April 13, 2010

JCA Resource Adapter transaction management in BPEL

The JCA Resource Adapter can support transactions on systems with a BPEL client. When designing your BPEL processes, keep the following in mind:

  • A good practice is to define a scope within BPEL processes where a sequence of opcodes called with a transaction are executed, and to add a catch block in this scope and call abort if any error occurs.
  • The BPEL processes must abort all open transactions when any exception occurs, except for CommException. The JCA Resource Adapter throws CommException when the Portal Context closes or errors out but the transaction cannot be aborted.
  • The transaction operations described in the base Web service must not be used in a BPEL section that can trigger process hibernation or parallel processing. Those transaction operations must be in a BPEL section that performs synchronous invoke.

Note

The JCA Resource Adapter does not support nested transactions.

To set up JCA Resource Adapter transaction management in BPEL, perform the following:

  • In the BPEL client, set these BPEL partnerLink properties:
  • cacheConnections=false

When set to “false”, it releases connection right after completing the unit of work, and connection is available to OC4J connection pool.

  • useJCAConnectionPool=true

If we set this to true then it will ensures single threading through JCA LocalTransactions.

  • In the JCA Resource adapter, create a private connection pool for the connection factory.

Example :
1. Connection Pooling Scheme : Dynamic
2. Maximum Connections : 200
3. Minimum Connection : 50
4. Fixed Wait Timeout : 0

5. Expired Connection Cleanup: Periodically
6. Inactive Connection Timeout: 300

Maximum Connection= dm_n_fe * dm_max_per_fe

dm_n_fe and dm_max_per_fe entries in dm_oracle pin.conf. Increase the values if required.

You encounter the following exception when the above steps are not performed properly or when one of the BPEL processes fails to close a transaction.

§ java.lang.IllegalStateException: New ManagedConnection cannot be created for a thread which is already in BRM transaction

§ Adapter Framework unable to create outbound JCA connection.

Friday, April 9, 2010

SOA Cluster Installation - Issues & Resolutions

Some issues that we might face during cluster installation:

Issue#1:

XML Parsing Error: no element found on esb console

Resolution#1:

The cause of the error was cluster_name collision for esb-dt and esb-rt.

vi $ORACLE_HOME/j2ee/oc4j_soa/applications/esb-rt/META-INF/orion-application.xml
vi $ORACLE_HOME/j2ee/oc4j_soa/application-deployments/esb-rt/orion-application.xml

Change “cluster_name” value to “ESBCluster” from "esb". Update your esb systems with this name on esb console i.e. update Cluster Name of each system with "ESBCluster".

Issue#2:

You see message “You have more than one instance of the Application Server Control application running in this cluster. This is not a recommended configuration and could lead to unexpected problems. Please stop the additional instances of Application Server Control or disable routing to these instances.” on the enterprise manager console.

Resolution#2:

Execute below command on all the non primary nodes.

opmnctl stopproc process-type=admin application=ascontrol

Issue#3:

When replacing the existing OPatch with a new patch then on running command opatch –version below error might come:
-bash: $ORACLE_HOME/OPatch/opatch: Permission denied

Resolution#3:

cd $ORACLE_HOME

chmod -R 755 OPatch

Issue#4:

java.net.SocketTimeoutException: Read timed out or java.net.SocketTimeoutException: connection reset when trying to initiate a bpel process on the bpel console.

Resolution#4:

Modify httpd.conf available at $ORACLE_HOME/Apache/Apache/conf on all the nodes.

Set KeepAlive as ‘Off’. Restart HTTP Server using command

opmnctl startproc process-type=HTTP_Server

I also recommend to cross check your load balancer setting. Sometime incorrect setting also causes this issue.

Issue#5:

An unhandled exception has been thrown in the ESB system. The exception reported is: "java.lang.Exception: Failed to create "ejb/collaxa/system/DeliveryBean" bean; exception reported is: "javax.naming.NameNotFoundException: ejb/collaxa/system/DeliveryBean not found

Resolution#5:

Modified ant-orabpel.properties file available @ $ORACLE_HOME/bpel/utilities.

Cluster=true

oc4jinstancename = SOA_GROUP

local.oc4jinstancename = oc4j_soa

Please make sure there is no space after true,SOA_GROUP and oc4j_soa.

Issue#6:

During installation of Oracle Service Registry, the installation fails with “null

Installation failed. If accessible, see "/oracle/registry_10_1_3/log/install.log".

To correct installation parameters and resume installation click Recover.” error.

Resolution#6:

One cause of this error is incorrect java version.

[oracle@HOSTNAME ~]$ java -version

java version "1.4.2"

gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-44)

update the JAVA_HOME to point to the soa suite java

export JAVA_HOME=$ORACLE_HOME/jdk

Issue#7:

During installation of DB, swap space requirements availability check the expected result ie swap memory is less than the actual result.

Resolution#7:

You can resolve this issue by creating a swap file. If installer is expecting 7832 the swap should have 7832*1024 = 8019968

1. Login as root

2. dd if=/dev/zero of=/swapfile bs=1024 count=8019968

8019968+0 records in

8019968+0 records out

8212447232 bytes (8.2 GB) copied, 82.5765 seconds, 99.5 MB/s

3. mkswap /swapfile

Setting up swapspace version 1, size = 8212443 kB

4. swapon /swapfile

5. Edit /etc/fstab

/swapfile swap swap defaults 0 0

6. Verify by cat /proc/swaps

7. Exit from root

Monday, April 5, 2010

Cannot find service on current cluster

This issue comes on High Availability Cluster environment.

The various cause of this issue are:
1. Cluster setup issue -
a. Slide Repository not configured to use the Database as the Repository
b. JNDIs for the Topic and Topic Connection Factory not created for esb-dt and esb-rt.
If any or both of the above configuration is missing then you have to do it on all the nodes and for both esb-dt and esb-rt(oc4j_soa) containers.

2. On ESB Console, cluster name is not set to esb-rt cluster_name. Verify on all nodes that the cluster_name @ $ORACLE_HOME/j2ee//applications/esb-rt/META-INF/orion-application.xml and $ORACLE_HOME/j2ee/oc4j_soa/application-deployments/esb-rt/orion-application.xml. e.g. cluster_name should be "ESBCluster" in both the files and not "esb". Then we need to update all the ESB systems cluster name by replacing "esb" with "ESBCluster". Restart the server if any of the above is modified.

3. The ESB Service is missing on the other nodes.
Run Opmnctl status -app|grep esb-rt
if for esb-rt, routable=false then update ohs-routing="false" to "true" at $ORACLE_HOME/j2ee/OC4J_SOA/config/default-web-site.xml where web-app application="esb-rt" name="provider-war" load-on-startup="true".

Hope this help ...

Saturday, January 23, 2010

Oracle BPEL & ESB - Error & Resolution - 2

Error 8: An unhandled exception has been thrown in the ESB system. The exception reported is: "java.util.zip.ZipException: error in opening zip file"
Resolution: Same as that of Error 6 & 7.


Error 9: xref:lookupxref not found when compiling bpel process. This happens when we use xref:lookupxref in assign activity instead of transformation activity.
Resolution: Search for http://www.oracle.com/XSL/Transform/java/oracle.apps.aia.core.xpath.AIAFunctions in .bpel file and replace the namespace with xref. Eg if its
xmlns:ns14= http://www.oracle.com/XSL/Transform/java/oracle.apps.aia.core.xpath.AIAFunctions
then replace ns14 with xref ie
xmlns:xref= http://www.oracle.com/XSL/Transform/java/oracle.apps.aia.core.xpath.AIAFunctions


Error 10: "No WebService Provider is registered at this URL" when trying to open any service url on ESB Console.
Resolution: Workaround is to modify $Oracle_HOme/j2ee/oc4j_soa/config/default-web-site.xml file.
Remove 'ohs-routing=true' if its already present for esb-dt and esb-rt. If its absent then add it for esb-dt and esb-rt.
Restart the server.
Another workaround is to click on 'DISABLE' and then 'ENABLE' if the error is coming for few services only.
As a fix you have to apply MLR#18 on 10.1.3.3.


Error 11: XPath expression failed to execute.
Error while processing xpath expression, the expression is ""ora:getFaultAsString()"", the reason is Variant not found.
The variant ""__fault"" has not been declared in the current scope. All variants must be declared in the scope before being accessed.
Please check that the variant ""__fault"" is properly declared; otherwise there may be a misspelling in the name of the variant.
.
Please verify the xpath query.
Resolution: The cause of this error is assigning value to outofscope variable. When a fault is created such as remote fault, a variable is generated for it say SystemFaultMsg. Now if you try assign ora:getFaultAsString() to this variable then it will throw the above fault. So create a new global fault variable and then assign ora:getFaultAsString() to it.


Error 12: failed due to: null; nested exception is:
javax.resource.ResourceException when invoking an OPCODE of BRM.
Resolution:1. add false
in the partnerlink binding in bpel.xml of the partnerlink invoking which this error is coming.
2. You can try clearing the wsdl cache also from your bpel console.


Error 13:Oracle BPEL Domain Initialization Failed
Reported Error:
Incorrect db schema version.
The database schema version '2.0.51' from the database does not match the
version '10.1.3.3.17' expected by the server.
The database schema currently in place has probably been configured for a
previous release please re-install the database schema and try to start the server again.
Resolution: This error may be caused because of MLR rollback.
1. Source DB env
2. Login to your DB as orabpel
sqlplus
Enter user-name: orabpel
Enter password: Please check it with your admin about this pwd
3. SQL> select guid from version;
(Note down this value. It must be equal to 2.0.51 as shown in the error message)
4. SQL> UPDATE VERSION SET guid = '10.1.3.3.17';
5. SQL>exit
6. Restart your server

Tuesday, January 5, 2010

Oracle BPEL & ESB - Error & Resolution

I think its better to start my blogging with the errors that I have faced during development and their resolutions which worked for me. I am very excited to bring forth the first blog of my life. Your positive response will encourage me to share more and more of my knowledge with you. Sometimes for an error there are more than one resolution, I'll be highly thankful to you if you can share the other resolutions which are not present in this blog.

Error 1: XML-22036: (Error) Cannot convert result tree fragment to NodeSet
Detail: This error comes in the transformation file. This is due to the version mismatch of stylesheet.
Resolution: Change the version of stylesheet from '1.0' to '2.0' . Now redeploy your process.

Error 2: Invalid xml document.
According to the xml schemas, the xml document is invalid.
Please make sure that the xml document is valid against your schemas.
Resolution: One cause of this error could be when you set “validateXML” property “true”.
Please make it false and then retry.
Goto BPELConsole-> ManageBPELDomain ->Set validateXML =false.

Error 3: oracle.xml.parser.v2.XMLParseException: PI with the name 'xml' can occur only in the beginning of the document.
Resolution: Check the transformation file and ensure that "<?xml version="1.0" encoding="UTF-8" ?>" is the first line in all the XSL file.

Error 4: failed due to: null; nested exception is: javax.resource.ResourceException
Resolution: Add <property name="cacheWSIFPort">false</property>
in the partnerlink binding in bpel.xml of the partnerlink invoking which this error is coming.
Another resolution is to try clearing the wsdl cache at BPELConsole->BPEL Process-> Clear the wsdl cache.

Error 5:The Method 'commit' Cant Be Called When a Global Transaction is Active Displayed in log.xml
Resolution: Amend ESBDataSource to local in the $ORACLE_HOME/j2ee//config/data-sources.xml
i.e. <managed-data-source name="ESBDataSource" connection-pool-name="ESBPool"
jndi-name="jdbc/esb" tx-level="local" /><managed-data-source name="ESBDataSource" level="local">

Error 6:ESB Services disappeared
Check for "connection pool is full" in $OracleHome/opmn/logs/*soa*
Error 7:Unable to delete or register ESB on ESB console
Resolution: Login to EM console
Goto Cluster Topology -> Application Server ->oc4j_soa -> Application:default -> ResourceAdapter:OracleASjms ->Edit Connection Factory: OracleASjms/MyXATCF -> ConnectionPool:private
Increase Maximum Connections to 100.