Anda di halaman 1dari 14

Oracle SOA Best Practice And Troubleshooting Page 1 of 14

BLOGS HOME PRODUCTS & SERVICES INDUSTRIES SUPPORT PARTNERS COMMUNITIES ABOUT Sign In

Oracle SOA Best Practice And Troubleshooting

About
Configuring XA For AQ JMS Adapter With Oracle RAC
By Pete Wang on July 4, 2010 11:18 PM

This note describes the best practice of configurating XA for AQ JMS Adapter on SOA 10.1.3.4 with Oracle RAC
Database that hosts AQ based JMS topics or queues, For more details about Oracle SOA XA and RAC Database
Configuration, please refer to the Oracle White Paper - Oracle SOA Suite 10g XA and RAC Database Configuration
Guide, which is available on http://www.oracle.com/technology/tech/soa/ha/index.html.

Software and Patch Requirements


My Profile
z SOA suite must be patched to 10.1.3.4 MLR8 or above.
Search All Blogs
z Oracle Database 10.2.0.3+ and 11.1.0.6+ are XA certified.
z JTA/XA Patch 8442423 and Patch 8328051.
z Patch 9213052 (Fixes JDBC connection issue when one RAC instance hosting the AQJMS is down)
z Patch 9442233 Google Search

Configuring AQ JMS Adapter


Google
1. Creating AQ Users and Granting Privileges b Only search this blog
c
d
e
f
g
Create a AQ user if such user does not exist in the Oracle Database Instance. Then grant the user necessary
privileges to enqueue and dequeue messages. To achieve this, run the following sql scripts. Recent Posts

Configuring XA For AQ JMS


connect / as sysdba Adapter With Oracle RAC
drop user jmsuser cascade; Coherence Configuration For
create user jmsuser identified by welcome1; Multiple HA SOA Domains
grant connect, resource, aq_administrator_role to jmsuser; How to implement multi-source
grant execute on sys.dbms_aqadm to jmsuser; XSLT mapping in 11g BPEL
How Does Restricted Task
grant execute on sys.dbms_aq to jmsuser;
Reassignment Work In SOA
grant execute on sys.dbms_aqin to jmsuser;
11g
grant execute on sys.dbms_aqjms to jmsuser;
How To Configure BAM 11g
exec dbms_aqadm.grant_system_privilege('ENQUEUE_ANY','jmsuser'); With LDAP Servers
exec dbms_aqadm.grant_system_privilege('DEQUEUE_ANY','jmsuser'); How To Deploy SOA 11g
2. Creating JMS Queues or Topics Composites Using ANT
Connect to DB instance as the AQ user. Run the following script to create and start JMS queue. A DB Adapter Sample For Pure
SQL and
connect jmsuser/welcome1 LogicalDeletePollingStrategy
exec dbms_aqadm.create_queue_table(queue_table=>'JMSDEMO_QUEUE_TABLE', Scenario
queue_payload_type=>'sys.aq$_jms_text_message', How does Email Notification
work in BPEL 10.1.3.3
multiple_consumers=>false);
How To Enable Logging to
exec dbms_aqadm.create_queue(queue_name=>'JMSDEMO_QUEUE',
Debug BAM 11g Security
queue_table=>'JMSDEMO_QUEUE_TABLE');
Issues
exec dbms_aqadm.start_queue(queue_name=>'JMSDEMO_QUEUE'); Things To Know When
commit; Applying An Adapters Patch for
3. Granting permissions to XA recovery user SOA Suite
Create a new user "xauser" if such user does not exist in your Database instance, then grant permissions to
this user. The SQL script is, Top Tags

BPEL SOA SOA HA SOA Task


create user xauser identified by welcome1; Worklist SOA XA XSLT

grant select on dba_pending_transactions to xauser; Categories


grant execute on sys.dbms_system to xauser;
4. Configuring OC4J Resource Provider SOA10g
Resource Provider is an abstraction that enables to plug in third-party message providers for JMS Adapters
connections. To configure AQ JMS Resource Provider, you need to specify the following properties in BPEL
$ORACLE_HOME/j2ee/OC4J_SOA/config/application.xml, SOA11

{ Resource Provider name - unique identifier of the resource provider BAM


{ Resource Provider class - "oracle jms OjmsContext"

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 2 of 14

{ Resource Provider class oracle.jms.OjmsContext


BPEL

{ JNDI name of the Data source that is used to connect to database hosting AQ queues or topics. Archives

For example, July 2010


April 2010
January 2010
<RESOURCE-PROVIDER name="aqjmsRAC" class="oracle.jms.OjmsContext">
December 2009
<description></description>
November 2009
<property name="datasource" value="jdbc/aqjmsRACDS"></property>
</RESOURCE-PROVIDER> RSS

Subscribe to this blog's feed


5. Configuring Data Source Used by AQ JMS Resource Provider
To configure data source used by AQ JMS, Open $ORACLE_HOME/j2ee/OC4J_SOA/config/data-
sources.xml in a text editor, then add connection pool and data source by specifying
This weblog is licensed under a
{ XA Connection factory class which is oracle.jdbc.xa.client.OracleXADataSource Creative Commons License.
{ JDBC Connection URL - Provides username, password and JDBC connection string that are used to
connect to DB. The syntax to connect to RAC DB is as follows, Powered by
Movable Type and Oracle

url="jdbc:oracle:thin:@(DESCRIPTION=
(ADDRESS_LIST=(LOAD_BALANCE=on)
(ADDRESS=(PROTOCOL=tcp)(HOST=host1-vip)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=host2-vip)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=ORCLSVC)))
{ Configure XA recovery required by OC4j Transaction Manager to conduct recovery process for
database resources. Add the following after connection factory setting.

<xa-recovery-config>
<password-credential>
<username>xauser</username>
<password>welcome1</password>
</password-credential>
</xa-recovery-config>
{ Config connection pool properties. The following properties are recommended.

„ min-connections - Specify the minimal connections in the pool


„ max-connections - Specify the maximal connecitons in the pool
„ validate-connection and validate-connection-statement - these are recommended settings that
enables validating JDBC connection when getting a connection from pool
{ Configure a data source that uses the connection pool. The data source JNDI name should match the
one specified in AQ JMS Resource Provider configuration.
Here is the example of data source configuration.

<connection-pool name="aqjms_rac_pool" max-connections="50" min-connection


validate-connection="true" validate-connection-statement="select 1 fr
<connection-factory factory-class="oracle.jdbc.xa.client.OracleXADa
user="jmsuser" password="welcome1"
url="jdbc:oracle:thin:@(DESCRIPTION=
(ADDRESS_LIST=(LOAD_BALANCE=on)
(ADDRESS=(PROTOCOL=tcp)(HOST=host1-vip)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=host2-vip)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=ORCLSVC)))"
commit-record-table-name="">
<xa-recovery-config>
<password-credential>
<username>xauser</username>
<password>welcome1</password>
</password-credential>
</xa-recovery-config>
<fatal-error-codes>
<error-code code="17008"/>
</fatal-error-codes>
</connection-factory>
</connection-pool>
<managed-data-source connection-pool-name="aqjms_rac_pool"
/

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 3 of 14

jndi-name="jdbc/aqjmsRACDS" name="aqjmsRACDS"

manage-local-transactions="false"/>
6. Configuring JMS Adapter
To configure JMS Adapter, Open $ORACLE_HOME/j2ee/OC4J_SOA/application-
deployments/default/JmsAdapter/oc4j-ra.xml in a text editor, then specify

{ location - The JNDI name of JMS Adapter Connection Factory.


{ connectionFactoryLocation - The AQ JMS Connection Factory Location. Set this property to
java:comp/resource/$RESOURCE_PROVIDER/$CONNECTION_FACTORIES/$NAME, where

„ $RESOURCE_PROVIDER is the Resource Provider name for AQ JMS.


„ $CONNECTION_FACTORIES can be either QueueConnectionFactories or
TopicConnectionFactories. For XA configuration, it must use either
XAQueueConnectionFactories or XATopicConnectionFactories.
„ $NAME - Can be any name for the connection factory
{ isTopic - Set to false if this is a queue
{ isTransacted - Set to false. JMS adapter will use local transaction instead of global transaction if this
property is set to true. Always set this property to false when using XA
{ username - AQ JMS username
{ password - AQ JMS password
For example, the configuration looks like

<CONNECTOR-FACTORY location="eis/AqjmsRAC/DemoQueue" connector-name="Jms A


<CONFIG-PROPERTY name="connectionFactoryLocation"
value="java:comp/resource/aqjmsRAC/XAQueueConnectionFactories/myQCF
<CONFIG-PROPERTY name="factoryProperties" value="" />
<CONFIG-PROPERTY name="acknowledgeMode" value="AUTO_ACKNOWLEDGE"/>
<CONFIG-PROPERTY name="isTopic" value="false" />
<CONFIG-PROPERTY name="isTransacted" value="false" />
<CONFIG-PROPERTY name="username" value="jmsuser" />
<CONFIG-PROPERTY name="password" value="welcome1" />
<CONNECTION-POOLING use="none">
</CONNECTION-POOLING>
<SECURITY-CONFIG use="none">
</SECURITY-CONFIG>
</CONNECTOR-FACTORY>
Designing BPEL Process To Produce/Consume Messsages From AQ JMS Queues/Topics
This note will not describe how to use JMS Adapter in BPEL/ESB to produce or consume messages. However, I
would like to share some tips and tricks of using JMS Adapters here.

1. Always check the wsdl file generated by JMS Adapter Wizard. Verify if location value for jca:address element
matches the JNDI name specified in JMS Adapter Connection Factory in oc4j-ra.xml
2. UseMessageListener attribure for jca:operation element in the wsdl file must be set to false. JMS Adapter
only supports polling approach for inbound operations on SOA 10.1.3.4 or above version.
3. Just a clarification that cacheConnections property is set to true by default for JMS Adapter partnerlink in
BPEL, You don't need to change this to false.

Continue reading "Configuring XA For AQ JMS Adapter With Oracle RAC" »

Tags: SOA XA

Comments (5)

Coherence Configuration For Multiple HA SOA Domains


By Pete Wang on April 14, 2010 1:58 PM
The HA document does not require the specificaiton of wka port and localport for coherence, but if you would like to
create multiple SOA HA domains, You have to use different coherence settings for these domains,

For SOA Domain 1 , set the following properties in the weblogic server startup argument.

-Dtangosol.coherence.wka1=apphost1vhn1 -Dtangosol.coherence.wka1.port=<port1>
-Dtangosol.coherence.wka2=apphost2vhn1 -Dtangosol.coherence.wka2.port=<port1>
-Dtangosol.coherence.localhost=apphost1vhn1 -Dtangosol.coherence.localport=<port1>

For SOA Domain 2 , set the following properties in the weblogic server startup argument.

-Dtangosol.coherence.wka1=apphost1vhn1 -Dtangosol.coherence.wka1.port=<port2>

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 4 of 14

-Dtangosol.coherence.wka2=apphost2vhn1 -Dtangosol.coherence.wka2.port=<port2>

-Dtangosol.coherence.localhost=apphost1vhn1 -Dtangosol.coherence.localport=<port2>

<port1> and <port2> must be different.

 
Tags: SOA HA

Comments (0)

How to implement multi-source XSLT mapping in 11g BPEL


By Pete Wang on April 14, 2010 11:17 AM

In SOA 11g, you can create a XSLT mapper that uses multiple sources as the input. To implement a multi-source
mapper, just follow the instructions below,

1. Drag and drop a Transform Activity to a BPEL process


2. Double-click on the Transform Activity, the Transform dialog window appears.
3. Add source variables by clicking the Add icon and selecting the variable and part of the variable as needed.
You can select multiple input variables. The first variable represents the main XML input to the XSL mapping,
while additional variables that are added here are defined in the XSL mapping as input parameters.
4. Select the target variable and its part if available.
5. Specify the mapper file name, the default file name is xsl/Transformation_%SEQ%.xsl, where %SEQ%
represents the sequence number of the mapper.

6. Click OK, the xls file will be opened in the graphical mode. You can map the sources to the target as usual.
7. Open the mapper source code, you will notice the variable representing the additional source payload, is
defined as the input parameter in the map source spec and body

<mapSources>
<source type="XSD">
<schema location="../xsd/po.xsd"/>
<rootElement name="PurchaseOrder" namespace="http://www.oracle.com/pcbpel/po"/>
</source>
<source type="XSD">
<schema location="../xsd/customer.xsd"/>
<rootElement name="Customer" namespace="http://www.oracle.com/pcbpel/Customer"/>
<param name="v_customer" />
</source>
</mapSources>

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 5 of 14

</mapSources>

...
<xsl:param name="v_customer"/>

8. Let's take a look at the BPEL source code used to execute xslt mapper.

<assign name="Transform_1">
<bpelx:annotation>
<bpelx:pattern>transformation</bpelx:pattern>
</bpelx:annotation>
<copy>
<from expression="ora:doXSLTransformForDoc('xsl/Transformation_1.xsl',bpws:getVariableData
('v_po'),'v_customer',bpws:getVariableData('v_customer'))"/>
<to variable="v_invoice"/>
</copy>
</assign>

9. You will see BPEL uses ora:doXSLTransformForDoc XPath function to execute the XSLT mapper.

This function returns the result of XSLT transformation when the xslt template matching the document. The
signature of this function is ora:doXSLTransformForDoc(template,input, [paramQName, paramValue]*).

Where
template is the XSLT mapper name
input is the string representation of xml input,
paramQName is the parameter defined in the xslt mapper as the additional source
parameterValue is the additional source payload.
10. You can add more sources to the mapper at the later stage, but you have to modify the
ora:doXSLTransformForDoc in the BPEL source code and make sure it passes correct parameter and its
value pair that reflects the changes in the XSLT mapper.

So the best practices are :

z create the variables before creating the mapping file, therefore you can add multiple sources when you define
the transformation in the first place, which is more straightforward than adding them later on.
z Review ora:doXSLTransformForDoc code in the BPEL source and make sure it passes the correct
parameters to the mapper.

Tags: XSLT

Comments (4)

How Does Restricted Task Reassignment Work In SOA 11g


By Pete Wang on January 6, 2010 2:21 PM

Task re-assignment is a common scenario in Human worklist applications, and it should


be restricted in many cases. In other words, the assignees are to be restricted to certain
users or groups who have the permission to handle these tasks. For example, ln a
financial company, a human task is assigned to the loans group, when the task needs to
be reassigned, it can only be assigned to legal group, not the investments group. What
happens in the current worklist application is,  if a user clicks a task and choose
reassign from the action list, it allows the user to reassign the task to any other users or
groups available in the identity store.

SOA 11g supports the restricted assignment feature. To do it,  you need some
customizaton for your worklist application. Below are the steps that show you how to
achieve this.

1.  Write a java class to implement


oracle.bpel.services.workflow.task.IRestrictedAssignmentCallback interface.  Oracle
Development has provided an example that demonstrates how the implementation can
be done.

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 6 of 14

Basically, you need to implement two methods, getPermittedAssignees and


getRestrictedOperations.

In getPermittedAssignees method, you need to


z create oracle.bpel.services.workflow.task.impl.TaskAssignee objects representing task assignees, like users,
groups, or application roles
z Add all assignee objects to a List, then use the list to construct a
oracle.bpel.services.workflow.task.impl.RestrictedAssignees object to hold these values.
z return the reference to RestrictedAssignees object.

In getRestrictedOperations, you need to specify what operations you want to restrict


task assignments.

Note: You can create such java class inside of your BPEL/Worklist project in
JDeveloper, you need to add BPM Workflow java library to compile the class

package sample;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import oracle.bpel.services.workflow.task.IRestrictedAssignmentCallback;
import oracle.bpel.services.workflow.task.IRestrictedAssignees;
import oracle.bpel.services.workflow.task.ITaskAssignee;
import oracle.bpel.services.workflow.task.impl.TaskAssignee;
import oracle.bpel.services.workflow.task.impl.RestrictedAssignees;
import oracle.bpel.services.workflow.task.model.Task;
import oracle.bpel.services.workflow.IWorkflowConstants;

public class RestrictedAssignmentCallback implements


oracle.bpel.services.workflow.task.IRestrictedAssignmentCallback {

public IRestrictedAssignees getPermittedAssignees(Task task, z

Map propertyMap,
String currentUser,
String identityContext,
String operation) {
if(operation.equals(
IRestrictedAssignmentCallback.OperationType.REASSIGN.toString())) {
return new RestrictedAssignees(createReassignTaskAssigneeList(),
true);
} else if(operation.equals(
IRestrictedAssignmentCallback.OperationType.ROUTE.toString())) { z

return new RestrictedAssignees(createParallelTaskAssigneeList(),


true);
}
return null;
}

public List getRestrictedOperations(Task task,


Map propertyMap,
String currentUser,
String identityContext) {
List retList = new ArrayList();
retList.add(RestrictedAssignmentCallback.OperationType.REASSIGN);
retList.add(RestrictedAssignmentCallback.OperationType.ROUTE);
return retList; z
}

private ITaskAssignee createTaskAssignee(String name, boolean isGrp) {

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 7 of 14

return (new TaskAssignee(name, isGrp));

} z

private List createReassignTaskAssigneeList() {


List retList = new ArrayList();
retList.add(createTaskAssignee("jstein",
IWorkflowConstants.IDENTITY_TYPE_USER));
retList.add(createTaskAssignee("jcooper",
IWorkflowConstants.IDENTITY_TYPE_USER));
retList.add(createTaskAssignee("LoanAgentGroup",
IWorkflowConstants.IDENTITY_TYPE_GROUP));
//retList.add(createTaskAssignee("DevTeam",
//IWorkflowConstants.IDENTITY_TYPE_APPLICATION_ROLE));
return retList;
}

private List createParallelTaskAssigneeList() {


List retList = new ArrayList();
retList.add(createTaskAssignee("jcooper", false));
retList.add(createTaskAssignee("jstein", false));
retList.add(createTaskAssignee("wfaulk", false));
retList.add(createTaskAssignee("cdickens", false));
retList.add(createTaskAssignee("jlondon", false));
return retList;
}

private ITaskAssignee createTaskAssignee(String name, String type) {


return (new TaskAssignee(name, type));
}

Comments (4)

How To Configure BAM 11g With LDAP Servers


By Pete Wang on December 14, 2009 6:56 AM

To configure BAM 11g to use LDAP server as the identity store, you need to perform the following steps.

STEP 1. Setup LDAP Authentication Provider in WebLogic Server Console.

The following document describes how to add an Authentication Provider in WebLogic Server.

18.6.1 Adding an Authentication Provider


Oracle® Fusion Middleware Administrator's Guide for Oracle SOA Suite
11g Release 1 (11.1.1)
Part Number E10226-01
http://download.oracle.com/docs/cd/E12839_01/integration.1111/e10226/hwf_config.htm#BABBGJIB

There are two important things I would like to point out here,

1. It is recommended to choose SUFFICIENT from the Control Flag drop-down list when configuring your own
Authentication Provider.

This specifies that if a user is authenticated successfully using this authenticator, WebLogic should accept the
authentication and not continue to invoke any additional authenticators. If the authentication fails, Oracle WebLogic
Server attempts to authenticate the user using the next authenticator in the list.

If you set the Control Flag to SUFFICIENT, ensure that all subsequent authenticators also have the Control Flag set
to SUFFICIENT. Likewise, ensure that the Control Flag of the default authenticator is set to SUFFICIENT as well.

2. SOA 11g R1 does not support multiple authentication providers, even you can specify them in WebLogic Server
Level. The reason behind this is that Java Portlet Specification (JPS) , the shared security framework used by SOA,
does not support multiple authentication providers, more specifically, it only provides authorization against the first

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 8 of 14

entry in the list of providers. (see Oracle Documentation Bug 8241202). Therefore, if you would like to login as the
user from the default authentication provider, such as "weblogic", you have to add the user to the provider you would
like to use and reorder the authentication provider to the the top of the list.

The above step should work fine if you only use SOA Worklist Application. Below are the extra steps that are specific
to BAM.

STEP 2 Create OracleSystemUser in LDAP Server.

OracleSystemUser is an internal user used by BAM Server to perform user synchronization operations. Create this
user in the base DN that you specified in STEP 1.

STEP 3

Run the following SQL statement to initialize BAM users synchronization table in the Oracle BAM schema:

UPDATE "SysIterUser" SET "SysIterUser"."GUID" = NULL,


"SysIterUser"."Inactive" = NULL;

After users successfully login to BAM, they will be registered in the "SysIterUser" table, and set the "INACTIVE" field
to 0, which indicates it is an active user. A BAM server thread is scheduled to run every 5 minutes by default to
synchronize the users between BAM and Authentication Provider. If users can not be identified in the first
authentication provider, the synchronization process will fail and consequently mark the user inactive.

If it happens, you need to run the above scripts to reset the login table.

Comments (2)

How To Deploy SOA 11g Composites Using ANT


By Pete Wang on November 24, 2009 8:08 AM

Jdeveloper can be used to deploy SOA composites, but using ant is getting more popular as it
brings us more flexibility, functionality, and productivity in the following scenarios,
zDeploy a SOA application that includes mutiple composites having dependencies.
z Use deployment plan to deploy soa composites into different environments.

z Deployment is performed on Machines that do not have Jdeveloper installed.

The purpose of this article is to explains how to create ant files to deploy SOA composite
projects on 11g
<!--[if !supportEmptyParas]--> <!--[endif]-->
Step 1 - Create build.properties file
The first step is to create a bin directory under your project fold, then create a build.properties
file under bin folder. The properties required are described in Table -Build Properties as follows,
Table - Build Properties
Property Name Description
composite.name The composite name specified in the composite.xml of
the project
composite.revision The revision of the composite
oracle.home The oracle home where ant scripts, soa mobules and
libs are located. If Jdevelper 11g is installed,
then Set this property to <JDEV_HOME>/jdeveloper,
where <JDEV_HOME> is JDEV installation directory. If
SOA suite 11g is also installed on the same machine,
this propety can also be set to the SOA Server Home,
which is the same as the soa.server.oracle.home.
When specifying directory path on windows, either
"/" or "\\" can be used. While on Unix or Linux, "/"
is the one to use. For example, on windows, the
oracle.home can be set as,
oracle.home=C:/oracle/JDEVHome/jdeveloper or
oracle.home=C:\\oracle\\JDEVHome\\jdeveloper
l h Th SOA id l h di t d d f

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 9 of 14

soa.server.oracle.home The SOA server side oracle home directory needed for

deployment plans and the weblogic sca library


deployment, e.g.
soa.server.oracle.home=<Middleware_Home>/Oracle_SOA1
admin.server.host WebLogic Admin Server hostname
admin.server.port WebLogic Admin Server Port, default is 7001
server.domain.name WebLogic Server domain name
managed.server.host WebLogic Managed Server hostname, managed server is
the one where SOA Suite is deployed
managed.server.port WebLogic Managed Server port, the default is 8001
server.user Weblogic Server Administrator username, weblogic by
default
server.password Weblogic Server Administrator password
server.targets WebLogic Managed Server Name where SOA is deployed.
soa_server1 is the default value.

<!--[if !supportEmptyParas]--> <!--[endif]-->


A build.properties sample
# build file for HelloWorldComposite
composite.name=HelloWorldComposite
<!--[if !supportEmptyParas]--> <!--[endif]-->
# revision of the composite
composite.revision=1.0
<!--[if !supportEmptyParas]--> <!--[endif]-->
# Set oracle.home to <JDEV_HOME>/jdeveloper, where <JDEV_HOME> is JDEV #
installation directory
oracle.home=D:/oracle/JDEHome/jdeveloper
<!--[if !supportEmptyParas]--> <!--[endif]-->
# soa-server side oracle home directory - needed for deployment plans
# and the weblogic sca library deployment
soa.server.oracle.home=/opt/oracle/Middleware/Oracle_SOA1
<!--[if !supportEmptyParas]--> <!--[endif]-->
###### Deployment server connection information
<!--[if !supportEmptyParas]--> <!--[endif]-->
# the admin server connection information
admin.server.host=<hostname>
admin.server.port=7001
<!--[if !supportEmptyParas]--> <!--[endif]-->
# the domain where soa infra is installed
server.domain.name=soa_domain
<!--[if !supportEmptyParas]--> <!--[endif]-->
# connection information for the managed server, used for soa-deployment
managed.server.host=<hostname>
managed.server.port=8001
<!--[if !supportEmptyParas]--> <!--[endif]-->
# User and credentials for the servers
server.user=weblogic
server.password=welcome1
<!--[if !supportEmptyParas]--> <!--[endif]-->
# wls server where soa is targeted.
server.targets=soa_server1
<!--[if !supportEmptyParas]--> <!--[endif]-->
Step 2 - Create build.xml file
The build.xml file is the used to define tasks that can be executed by ant. The targets compile-
package, deploy will be created in the following steps.
<!--[if !supportLists]-->1. <!--[endif]-->Create a build.xml in the bin directory of the project
folder, copy the following contents to the file.
<?xml version="1.0" encoding="UTF-8" ?>
<project name="HelloWorldComposite">

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 10 of 14

<project name HelloWorldComposite >

<!-- build.properties -->


<property file="build.properties"/>
<property name="deploy.dir" value="../deploy"/>
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!-- Add targets here -->
</project>
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportLists]-->2. <!--[endif]-->Add a compile-package target - As the package target
defined in ${oracle.home}/bin/ant-sca-deploy.xml can be executed by ant to compile and
package SOA composites to produce a deployable jar file, where oracle.home, is the property
defined in build.properties file. We will simply make an ant call to this target and pass the
required properties described in the table below.
Property Name Description
composite.name The composite name specified in the composite.xml of
the project
composite.revision The revision of the composite
oracle.home See Table - Build Properties for details
<!--[if !supportEmptyParas]--> <!--[endif]-->
java.passed.home Java Home passed to scac, the default value is
detected by ant, and will be overwritten to the
env.JAVA_HOME if such env variable is defined in OS
level
compositeDir The soa project directory where composite.xml is
located.
scac.application.home The soa application directory which is the parent
directory of compositeDir

<!--[if !supportEmptyParas]--> <!--[endif]-->


A compile-package target sample
<target name="compile-package">
<property name="sca-inf.classes.dir" value="../SCA-INF/classes"/>
<mkdir dir="${sca-inf.classes.dir}"/>
<ant antfile="${oracle.home}/bin/ant-sca-package.xml" target="package"
inheritall="false">
<property name="oracle.home" value="${oracle.home}"/>
<property name="compositeDir" value="${basedir}/../"/>
<!-- needed for adf config -->
<property name="scac.application.home" value="${basedir}/../.."/>
<!-- name of the composite -->
<property name="compositeName" value="${composite.name}"/>
<!-- revision of the composite -->
<property name="revision" value="${composite.revision}"/>
<!-- java.passed.home passed to scac, this property will be
overwritten to the env.JAVA_HOME if such env variable is defined
in OS level-->
<property name="java.passed.home" value="${java.home}"/>
</ant>
</target>
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportLists]-->3. <!--[endif]-->Add a deploy target - An ant build file,
${oracle.home}/bin/ant-sca-deploy.xml defines a deploy target that can be executed to deploy a
jar file to SOA server, where oracle.home, is the property defined in build.properties file. So
similar to the previous step, we need to create a target that run ant on the deploy target defined
in ant-sca-deploy.xml and pass the required properties listed in the table below,
Property Name Description
User Administrators who have the previledge to deploy

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 11 of 14

applications.

Password The password


serverURL Specifies the deployer url, which is http://
${managed.server.host}:${managed.server.port}/
soa-infra/deployer, where managed.server.host and
managed.server.port are properties defined in
build.properties.
sarLocation The location of the jar file
{deploy.dir}/sca_${composite.name}_rev$
{composite.revision}.jar
overwrite If it is set to true, it will overwrites the existing
deployments on the server.
configplan Specifies the Deployment plan to use.

<!--[endif]-->
A deploy target sample
<target name="deploy">
<condition property="deploymentplan.name" value="null">
<not>
<isset property="${deploymentplan.name}"/>
</not>
</condition>
<echo>Deploying to http://
${managed.server.host}:${managed.server.port}/soa-infra/deployer</echo>
<ant antfile="${oracle.home}/bin/ant-sca-deploy.xml" target="deploy"
inheritall="false">
<!-- reformat of prop names -->
<property name="user" value="${server.user}"/>
<property name="password" value="${server.password}"/>
<!-- create the url for deployment -->
<property name="serverURL" value="http://
${managed.server.host}:${managed.server.port}/soa-infra/deployer"/>
<!-- location of the sar -->
<property name="sarLocation"
value="${deploy.dir}/sca_${composite.name}_rev${composite.revision}.jar"/>
<!-- force overwrite if already there -->
<property name="overwrite" value="true"/>
<!-- configplan-->
<property name="configplan" value="${deploymentplan.name}"/>
</ant>
</target>
<!--[if !supportEmptyParas]--> <!--[endif]-->
Once the build.xml and build.properties are in places, you are ready to go for the deployment.
Tags: SOA

Comments (4)

A DB Adapter Sample For Pure SQL and


LogicalDeletePollingStrategy Scenario
By Pete Wang on November 16, 2009 7:57 AM

In many cases, customers would like to use custom SQL instead of Toplink generated SQL to poll database tables
using DB Adapter Logical Delete Polling Strategy, for example, they want to add some DB Hints in the SQL query to
improve performance.

The Database Adapter PollingPureSQLSysdateLogicalDelete sample under


ORACLE_HOME/bpel/samples/tutorials/122.DBAdapter/advanced/polling directory provides a solution that
showcases how to use custom sql (Pure SQL) and LogicalDeletePollingStrategy to poll database tables.

To make the sample work, here are some tips that you may need to know.

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 12 of 14

1. Pure SQL will not be executed by Toplink if you choose the second option (Logical
Delete) as the After Read Strategy in Adapter Configuration Wizard. In this case,
PollingStrategyName is set to LogicalDeletePollingStrategy in the DB Adapter wsdl file.

2. To make Pure SQL work with Logical Detele Strategy, you must choose the first
option (Delete the rows) as the After Read Strategy in Adapter Configuration Wizard, then
edit the toplink project directly by adding two custom SQLs, one for polling, the other for
after reading operations. In this case, the after reading SQL must be defined in Custom
SQL - Delete Tab.
The corresponding configuration in _toplink_mapping.xml file looks like,

For Pollling,
<opm:querying xsi:type="toplink:query-policy">
<opm:queries>
<opm:query name="Poll" xsi:type="toplink:read-all-query">
<toplink:timeout>0</toplink:timeout>
<toplink:call xsi:type="toplink:sql-call">
<toplink:sql>SELECT TITLE, '1' DIRECTOR, STARRING, SYNOPSIS, GENRE,
RUN_TIME, RELEASE_DATE, RATED, RATING, VIEWER_RATING, STATUS, TOTAL_GROSS, DELETED, SEQ

LAST_UPDATED FROM MOVIES WHERE (DELETED = 'FALSE') ORDER BY RELEASE_DATE ASC</toplink:s

</toplink:call>
<toplink:reference-class>Poll.Movies</toplink:reference-class>
<toplink:cache-usage>primary-key</toplink:cache-usage>
<toplink:lock-mode>none</toplink:lock-mode>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</opm:query>
</opm:queries>

For After Read,


<toplink:delete-query xsi:type="toplink:delete-object-query">
<toplink:call xsi:type="toplink:sql-call">
<toplink:sql>Update MOVIES SET DELETED = 'TRUE' WHERE TITLE =
#TITLE</toplink:sql>
</toplink:call>

Comments (2)

How does Email Notification work in BPEL 10.1.3.3


By Pete Wang on November 16, 2009 1:23 AM

This article explains how email notification works in BPEL 10.1.3.3

It is a two step asynchronous processing when BPEL engine handles Email Notification Activity.

z Notification Creation and Persistence - BPEL Process Manager will first create a notification object including a
unique NotificationID, other notification properties and message payload, and insert the notification details
into BPEL dehydration store, then it will send an empty JMS message with the notification ID property to an
internal queue to notify that the message is ready for delivery.

z Notification Delivery - When the JMS message arrives in the queue, a MDB thread will be allocated and
consumes the message. In the onMessage() method of the MDB, it will attempt to query the dehydration store
given the notification ID, then send the notification details through the pre-configured email channel. Please
note that message delivery happens in a separate thread than the BPEL execution thread.

Thus, there are two different threads that handle notification persistence and email delivery respectively. BPEL engine
must figure out the way to coordinate the threads execution, otherwise the race condition might occur. For example,
when the system message arrives earlier than the transaction commit for notification insertion in the database, MDB

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 13 of 14

thread will be kicked off first, as the data were not committed yet, the notification id can not be retrieved while

searching the Notification tables by the MDB thread. In this case, the email notification will fail.

The above scenario can work very well in normal situation, but if there is any notification failure due to email server
down, or network problems, etc. what BPEL can do about it?

A Quartz scheduler is used in BPEL 10.1.3.3 to handle this scenario. A quartz scheduler will start a thread that will
run every 15 minutes by default to send a batch of empty JMS messages with unique IDs to the JMS queue. But this
time, there is no message persistence, instead, the notification IDs are fetched by querying the dehydration store
given the state is either RETRY or SEND. In other words, if there are any records in the database where the state is
RETRY or SEND, these records will become deliverable candidates. MDB thread will then fetch messages details
from dehydration store and deliver them through emails. At the delivery stage, it will verify how many times the server
has attempted to deliver the message, the maximal attempt is 3 by default. If all these retries fail, it will update the
state of this notification in the dehydration store to ERROR

The following two properties can be configured in


SOA_Oracle_Home/bpel/system/services/config/wf_config.xml.

z oracle.bpel.services.notification.maxattempt - default value is 3. The property is use to control maximal


attempts a MDB will deliver a notification identified by Notification ID. If the maximal attempts are reached, the
notification status will be changed to "ERROR", otherwise, the status will be changed to "RETRY".

If the notification is in "ERROR" status, the only way to retry the message delivery
is to run the following script to update the BPELNotification table status to
RETRY. For example:
UPDATE BPELNotification
SET status = 'RETRY',
ATTEMPTEDNUMBER = 0
WHERE ID = <notification id>

z oracle.bpel.services.notification.publisher_interval - the default value is 15 (minutes). This property is


used to tell how often a Quartz scheduler job will be executed to search for deliverable notification and send
empty notification message via JMS. The default value should be suffice in more cases. If there are a lot of
message delivery failures or you want the scheduler to start more frequently, then you can reduce this setting.

But if the property is set too small, for example, 1 (minute), then there is a possibility that you will get duplicate
messages sent to the email server. Here is a scenario that might happen in the real world.

When BPEL PM processes the Notification Activity, it dehydrates the Notification details and that notification
becomes a candidate for MDB to deliver. Suppose delivery has not finished processing, thus the notification
record still resides in the dehydration store with status "SEND". If the Quartz scheduler job is executed at the
same time, it will also pick up the same notification as a deliverable candidate, thus causing the duplicate
messages being sent by MDB

Hopefully this article can help you understand how Notification service works in BPEL. If you have any questions,
please post here, I will try my best to answer. If you encounter any problems with Email Notification, errors, it is
highly recommended to go to the BPEL console and set collaxa.cube.services logger to DEBUG, then check the
ORACLE_HOME/opmn/logs/<opmn log file for soa container> for more information.

Tags: BPEL

Comments (8)

How To Enable Logging to Debug BAM 11g Security Issues


By Pete Wang on November 16, 2009 12:58 AM

To debug BAM 11g Security issues, such as user authentication or authorization, it is recommended to set
oracle.bam.adc.security and oracle.bam.common.security loggers to FINEST, then check the
ORACLE_HOME/user_projects/domains/<SOA DOMAIN>/servers/bam_server1/logs/bam_server1-diagnostic.log for
more information.

For more details on how to enable these BAM loggers, please refer to technical note in My Oracle Support. (Doc ID
966483.1).

http://blogs.oracle.com/soa_how_to/ 9/21/2010
Oracle SOA Best Practice And Troubleshooting Page 14 of 14

Comments (0)

Things To Know When Applying An Adapters Patch for SOA


Suite
By Pete Wang on November 13, 2009 4:56 AM

You may have seen some errors like ClassNotFound, MethodNotFound or NullPointerException after you apply a
patch which contains the bug fix for Oracle Application Server technology adapters, such as DB Adapter, AQ Adapter,
etc. This article explains why such error occurs and What solution could be used to resolve this problem..

First of all, Let's look at the adapters installation directory and its structures on Oracle SOA Suite 10.1.3.x .

When the adapters are first deployed to the application server, adapter rar files will be copied into different Adapter
Home which is $ORACLE_HOME/j2ee/<soa container>/connectors/<Adapter Name> , where <soa container> is the
SOA container name, and <Adapter Name> is the directory created for each adapters to store binaries and
deployment descriptors. Then the application server will extract these rar files into a sub directory which contains a jar
file with all the compiled java classes, and a META_INF folder where the deployment descriptors, like ra.xml, oc4j-
ra.xml or weblogic-ra.xml are stored. All these files will be maintained by the application server which knows when to
reload the new vesion of these files by comparing the timestamps.

When attempting to apply a patch for these adapters. Opatch will only update the RAR file with the patched jar file,
but not the jar file in the adapter sub directory under Adapter Home. In normal situation, the jar file should be
synchronized with the one in rar file, But in some cases, especially when the timestamps information for the rar and
jar files got corrupted, application server will not be able to identify the changes made in the rar file, and it will cause
inconsistency between the rar and jar file.

How to resolve this problem? to ensure the jar file always got updated correctly after a new patch is applied, as a best
practice, you should manually remove the Adapter folder and force the jar file generated by application server.

Another best practice is that you should alway have a backup of the deployment descriptor files before applying the
patch containing fixes for adapters. It is because the old files will be overwritten by the default one, and your previous
configuration will be lost.

Comments (0)

Archives

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle. Terms of Use | Your Privacy Rights

http://blogs.oracle.com/soa_how_to/ 9/21/2010

Anda mungkin juga menyukai