Monday 23 May 2011

Tweaking Node manager

I faced really a hard time to start the managed server from node manager. My installation is quite simple,

  1. I downloaded Oracle VM from http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html and installed the same with extension pack.
  2. I installed OEL 5 on VM.
  3. Then I installed Oracle Database 11gR2 and SOA suite 11.1.1.5 on top of that on single machine.
  4. Everything went fine and able to start the weblogic server as well as all the managed server successfully.
  5. Then I tried to start the managed server from node manager and its got erroring out!

Yes, my node manager is reachable from admin server, but I’m getting something strange error in soa_server1.out file,”JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)”.I checked the Linux firewall and disabled the same but it persists.After wasting some more time I figured out I need to change some java property in setDomainEnv.sh file(Thanks to Google!),by default it was

if [ "${debugFlag}" = "true" ] ; then
    JAVA_DEBUG="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=${DEBUG_PORT},server=y,suspend=n -Djava.compiler=NONE"

I changed to

if [ "${debugFlag}" = "true" ] ; then
    JAVA_DEBUG="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Djava.compiler=NONE"

After changing the Java Debugging Interface binding address it started working Smile

Here is my nodemanager.properties file,

#Sun May 22 03:56:09 PDT 2011
DomainsFile=/u01/app/oracle/product/fmw/wlserver_10.3/common/nodemanager/nodemanager.domains
LogLimit=0
PropertiesVersion=10.3
DomainsDirRemoteSharingEnabled=false
javaHome=/u01/app/oracle/product/fmw/jdk160_24
AuthenticationEnabled=true
NodeManagerHome=/u01/app/oracle/product/fmw/wlserver_10.3/common/nodemanager
JavaHome=/u01/app/oracle/product/fmw/jrockit_160_24_D1.1.2-4/jre
LogLevel=INFO
DomainsFileEnabled=true
StartScriptName=startWebLogic.sh
ListenAddress=
NativeVersionEnabled=true
ListenPort=5556
LogToStderr=true
SecureListener=true
LogCount=1
DomainRegistrationEnabled=false
StopScriptEnabled=true
QuitEnabled=false
LogAppend=true
StateCheckInterval=500
CrashRecoveryEnabled=false
StartScriptEnabled=true
LogFile=/u01/app/oracle/product/fmw/wlserver_10.3/common/nodemanager/nodemanager.log
LogFormatter=weblogic.nodemanager.server.LogFormatter
ListenBacklog=50

And other important rules for configuring node managers,

  1. In Node Manager listener address of Admin server don’t ever set ‘localhost’ either provide machine IP address or FQDN.
  2. Your node manager should be reachable from admin server.
  3. Whatever the managed server you want to start from node manager, put boot.properties file under security folder of your server.It contains the credentials,
  4. #Sun May 22 06:31:16 PDT 2011
    password=welcome1
    username=weblogic

Tuesday 17 May 2011

Configuring Transaction in Composite

Test Case: There are two table , one is Master and other is Child has primary/foreign key relationship. By a BPEL process we’ll insert the data into Master table and with other BPEL we’ll insert the data into Child in a same composite. But if any error occur while inserting the data into Child it will rollback all transactions in Master table as well.

Solution:Here I’ll use Dept and Emp table as Master and Child table.1st I’ll insert data into Dept and within same global transaction will insert data into Emp. After inserting the data into Emp I’ll throw rollback fault from BPEL and it will automatically rollback the insertion of Dept table data.Here is my composite,

image

The insertDeptBPEL is synchronous one,

image

The insertChildBPEL is synchronous one also,

image

Here in the throw activity,

image

Now the designing is complete, we need to define the transactional properties now in composite.xml like below,

<component name="insertDeptBPEL" version="1.1">
    <implementation.bpel src="insertDeptBPEL.bpel"/>
    <property name="bpel.config.transaction" many="false" type="xs:string">requiresNew</property>
    <property name="onewayDeliveryPolicy">sync</property>
  </component>
  <component name="insertChildBPEL" version="1.1">
    <implementation.bpel src="insertChildBPEL.bpel"/>
    <property name="bpel.config.transaction" many="false" type="xs:string">required</property>
  </component>

Then deploy the run the composite , data will not be inserted in either of the table as it will execute rollback from the code.

Saturday 14 May 2011

Customizing delete-polling strategy

I had one requirement, need to poll a table based on a particular field value and at the same time need to update a field on another table.In SOA 10g we can edit the toplink and add our custom query on delete or update tab. But in SOA 11g that toplink is replaced by or-mappings and we need to edit here.

So here are the steps you need to do and in my case I'm updating a field value of same table.

1.I created a table test in scott schema using sqldeveloper,its pretty simple..

image

2.A DB adapter and a polling BPEL process created based on that table.Select delete polling strategy.

image

In the adapter here is the screenshot of last step,

image

So in the polling query I’m checking if column3 is NULL or not.You can have your own criteria.

3.Then open getData-or-Mapping.xml file and add below lines in between  </queries> and </querying> to override the adapter generated delete query.

<delete-query>
               <call xsi:type="sql-call">
                  <sql>update test set column3='READ' where column1= #COLUMN1 </sql>
               </call>
</delete-query>

    In this sql tag you can call your custom pl/sql function or sql query to perform CRUD on any objects and whatever the parameter you are passing ,make sure those were selected during adapter creation wizard.  So here is my or-mappings.xml file,

    <?xml version="1.0" encoding="UTF-8"?>
    <object-persistence xmlns="http://www.eclipse.org/eclipselink/xsds/persistence" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:eclipselink="http://www.eclipse.org/eclipselink/xsds/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="Eclipse Persistence Services - 2.1.3.v20110304-r9073">
       <name>getData-OR</name>
       <class-mapping-descriptors>
          <class-mapping-descriptor xsi:type="object-relational-class-mapping-descriptor">
             <class>getData.Test</class>
             <alias>TEST</alias>
             <primary-key>
                <field table="TEST" name="COLUMN1" xsi:type="column"/>
             </primary-key>
             <events/>
             <querying>
                <queries>
                   <query name="getDataSelect" xsi:type="read-all-query">
                      <criteria function="isNull" xsi:type="function-expression">
                         <arguments>
                            <argument name="column3" xsi:type="query-key-expression">
                               <base xsi:type="base-expression"/>
                            </argument>
                         </arguments>
                      </criteria>
                      <reference-class>getData.Test</reference-class>
                      <lock-mode>none</lock-mode>
                      <container xsi:type="list-container-policy">
                         <collection-type>java.util.Vector</collection-type>
                      </container>
                   </query>
                </queries>
                <delete-query>
                   <call xsi:type="sql-call">
                      <sql>update test set column3='READ' where column1= #COLUMN1 </sql>
                   </call>
                </delete-query>
             </querying>
             <attribute-mappings>
                <attribute-mapping xsi:type="direct-mapping">
                   <attribute-name>column1</attribute-name>
                   <field table="TEST" name="COLUMN1" xsi:type="column"/>
                   <attribute-classification>java.lang.String</attribute-classification>
                </attribute-mapping>
                <attribute-mapping xsi:type="direct-mapping">
                   <attribute-name>column2</attribute-name>
                   <field table="TEST" name="COLUMN2" xsi:type="column"/>
                   <attribute-classification>java.lang.String</attribute-classification>
                </attribute-mapping>
                <attribute-mapping xsi:type="direct-mapping">
                   <attribute-name>column3</attribute-name>
                   <field table="TEST" name="COLUMN3" xsi:type="column"/>
                   <attribute-classification>java.lang.String</attribute-classification>
                </attribute-mapping>
             </attribute-mappings>
             <descriptor-type>independent</descriptor-type>
             <caching>
                <cache-type>weak-reference</cache-type>
                <cache-size>-1</cache-size>
                <always-refresh>true</always-refresh>
             </caching>
             <remote-caching>
                <cache-type>weak-reference</cache-type>
                <cache-size>-1</cache-size>
             </remote-caching>
             <instantiation/>
             <copying xsi:type="instantiation-copy-policy"/>
             <tables>
                <table name="TEST"/>
             </tables>
             <structure>structureName</structure>
          </class-mapping-descriptor>
       </class-mapping-descriptors>
       <login xsi:type="database-login">
          <platform-class>org.eclipse.persistence.platform.database.oracle.Oracle9Platform</platform-class>
          <user-name></user-name>
          <connection-url></connection-url>
       </login>
    </object-persistence>
    4. Deploy the process and you are done….check your test table and instances at em.