Wednesday, 23 December 2015

How to use Custom XPATH in SOA


Basic steps to follow :

1.Create a java class and implement your method.
2.Create a configuration file that describes the XPath function and links it to the java method.
3.Add the function at design time in JDev.
4.Make the function available at run time. 

For BPEL, Mediator and Human Workflow, this process is quite different.The class that contain the method must implement the interface oracle.fabric.common.xml.xpath.IXPathFunction.This interface has single method.The signature of he method is :

public Object call(oracle.fabric.common.xml.xpath.IXPathContext ctx,java.util.List params)

package xathbpelfunction;
import java.util.List;
import oracle.fabric.common.xml.xpath.IXPathContext;
import oracle.fabric.common.xml.xpath.IXPathFunction;
public class UtilityFunctions implements IXPathFunction{
   
    public Object call(IXPathContext context,List args) {
     
      String str=(String)args.get(0);
      return processString(str);
     
    }
   
     private String processString(String str){
      if(str==null)
          return null;
      return "hello "+str;
    }
}

Now create an XML file named "ext-soa-xpath-functions-config.xml"  and put it under the META-INF directory that you created.The source of the file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<soa-xpath-functions version="11.1.1" xmlns="http://xmlns.oracle.com/soa/config/xpath" xmlns:func="http://test.functions.com">
                    
  <function name="func:test">
    <className>xathbpelfunction.UtilityFunctions</className>
    <return type="string"/>
    <params>
      <param name="str" type="string"/>
    </params>
    <desc>hello world method</desc>
  </function>

</soa-xpath-functions>

Newly created Java Project needs to include the oracle.soa.fabric.jar in its classpath to support custom functions. Right click on the new Java Project in the Application Explorer and choose “Libraries and Classpath” Click the “Add Jar” button and navigate to the oracle.soa.fabic.jar in the  ${FMWHome}/Oracle_SOA1/soa/modules/oracle.soa.fabric_11.1.1/oracle.soa.fabric.jar

Next, notice that there is no method named test in out java class.Here the method 'call' is going to be invoked automatically when the function is invoked.Now create a jar file and follow the same steps as before to add the function in JDev at design time.Also, place the jar file in the   <<MW_HOME>>/user_projects/domains/<<domain_name>>/lib or under a sub-directory of lib and restart the weblogic server.

To use the custom function in SOA Suite we need to add it to the SOA extension libraries.  We do this by copying the jar file to the $ORACLE_SOA_HOME/soa/modules/oracle.soa.ext_11.1.1 directory on the SOA Suite installation.  We then run ant in that directory (setting JAVA_HOME if necessary) by executing $FMW_HOME/modules/org.apache.ant_1.7.1/bin/ant.
[oracle@soa.ext_11.1.1]$ ../../../../modules/org.apache.ant_1.7.1/bin/ant 
Buildfile: build.xml

create-manifest-jar: 
     [echo] Creating oracle.soa.ext at …/FMW/Oracle_SOA/soa/modules/oracle.soa.ext_11.1.1/oracle.soa.ext.jar…

BUILD SUCCESSFUL 
Total time: 1 second

We then need to restart the SOA Suite to get it to recognise the change.
Now create a SOA project and add a BPEL process.Then drag an assign activity.Open the assign and select copy operation.Then bring up the expression builder and select user defined extension function from the drop down menu.The function test should appear.

Monday, 12 October 2015

Unable to display Flowtrace due to exception while initializing object


It is most likely the issue is caused by missing roles and grants from the system-jazn-data.xml file. Make sure the system-jazn-data has the proper Roles and Grants by comparing with another working environment, if not possible use attached file "system-jazn-data.zip" that contains 2 system-jazn-data to compare, "system-jazn-data_BAD.xml" and "system-jazn-data_GOOD.xml" here you can see the differences between a good and bad one
1.- Stop all servers (admin and managed)
2.- Back up your "<DomanHome>/config/fmwconfig/system-jazn-data.xml" file
3.- Add the missing Roles and grants to the file from a previous backup or another working environment file
4.- start admin and then managed servers
5.- retest the issue

Even after that we observed that issue still persists. then we refer to (Doc ID 1644021.1) where the file DOMAIN_HOME/config/fmwconfig/audit-store.xml is 0 bytes or otherwise corrupted.

To resolve this issue:
1. Stop all the WebLogic servers in the domain, including AdminServer.
2. Restore the corrupted file DOMAIN_HOME/config/fmwconfig/audit-store.xml from a backup. Note that the backup must be the same version, patchset and PSU as the active environment.
3. Start all the WebLogic servers in the domain

Wednesday, 7 October 2015

FAILED_NOT_RESTARTABLE for ManagedServer in 11g


OPTION 1 :

It has been observed that Manager server went to FAILED_NOT_RESTARTABLE state. For first check what we can do below activities :

1. Stop all manageserver of that particular server.
2. Then nodemanager need to stop.
3. And then nodemanager need to start first.
4. Then manageserver need to start from admin console.

Many time this will resolved the issue.

OPTION 2 :

Normally When weblogic server starts, it creates two lock files :

  • $DOMAIN_HOME/servers/{$ManagedServer}/tmp/{$ManagedServer}.lok
  • $DOMAIN_HOME/servers/{$ManagedServer}/data/ldap/ldapfiles/EmbeddedLDAP.lok


When WebLogic server stops, it removes these two files. If you not stop server properly these lock files remain. In that case these files need to delete.

OPTION 3 :

But sometime when some more file got corrupted, the such basic thing does not help to resolve the issue. In that cache all data/cache/tmp folder need to remove. Below activities can be performed for the same.

1. Stop all manageserver of that particular server.
2. Then nodemanager need to stop.
3. Keep a backup of 3 folder :

  • $DOMAIN_HOME/servers/{$ManagedServer}/tmp
  • $DOMAIN_HOME/servers/{$ManagedServer}/cache
  • $DOMAIN_HOME/servers/{$ManagedServer}/data

4. After taking backup you can delete these folder.
5. Start nodemanager.
6. Start ManagedServer from admin console.

This will help to resolved the issue.

HTTP 500 error : 'java.io.IOException: Stream closed'



Whenever you are getting below error while accessing instances in em console you can try this :

If you are getting below error while clicking on instances :

==================================================

HTTP 500 error :
'java.io.IOException: Stream closed'

==================================================
CAUSE
==================================================

This means EM console instances got corrupted due to FlowTrace.jspx.xml file. After looking for $DOMAIN_HOME/sysman/mds/partition1/ai/sca/share/audit/mdssys/cust/user/weblogic/FlowTrace.jspx.xml file we found this file was 0 byte file after the disk filling failure.

==================================================
SOLUTION
==================================================

Restore the file $DOMAIN_HOME/sysman/mds/partition1/ai/sca/share/audit/mdssys/cust/user/weblogic/FlowTrace.jspx.xml with a backup or from a working environment.

Thursday, 10 September 2015

Daily Queries in SOAINFRA & XREF

:

Find BRM poid & CRM row_id from XREF :

SELECT MAX(DECODE(SUBSTR(XREF_COLUMN_NAME,0,3), 'BRM', XREF_COLUMN_NAME, NULL)) SOURCE_ID,
    MAX(DECODE(SUBSTR(XREF_COLUMN_NAME,0,3), 'BRM', VALUE, NULL)) BRM,
    MAX(DECODE(XREF_COLUMN_NAME, 'COMMON', VALUE,NULL)) COMMON,
    MAX(DECODE(SUBSTR(XREF_COLUMN_NAME,0,4), 'SEBL', VALUE,NULL)) SIEBEL
  FROM (select * from xref_data where row_number in
(select row_number from xref_data where value in ('0.0.0.1 /billinfo 31XXXXXXXX 0')))
  WHERE IS_DELETED     ='N'
  AND (XREF_TABLE_NAME ='oramds:/apps/AIAMetaData/xref/CUSTOMERPARTY_BILLPROFILEID.xref')
  GROUP BY row_number,
    XREF_TABLE_NAME;

Find Instances in SOA_INFRA :

select b.ID "Instance ID",b.title "Name",a.composite_name"Composite",Decode(a.state,5,'SUCCESS','FAILED')"Instance State",a.modify_date "Time",TO_CHAR(SUBSTR((a.modify_date-a.creation_date),18,6)) "Execution_Time" from cube_instance a,composite_instance b where
a.cmpst_id=b.ID and b.title like '%97430037778%' order by 5 desc;

Find instance of some composite in SOA_INFRA :

select b.ID,Decode(a.state,5,'SUCCESS','FAILED') "STATUS",a.component_name,b.title,
TO_CHAR(a.creation_date,'MM/DD/YYYY HH24:MI:SS') "CREATION_TIME",TO_CHAR(SUBSTR((a.modify_date-a.creation_date),18,6)) "EXECUTION_TIME"
from VFQ_SOAINFRA.cube_instance a,VFQ_SOAINFRA.composite_instance b where
a.cmpst_id=b.ID and component_name like '%QueryRealTimeBalanceSurePayProvABCSImpl%'
and a.creation_date between
tO_DATE('01/13/2015 11:00:00','MM/DD/YYYY HH24:MI:SS') and
TO_DATE('01/13/2015 12:00:00','MM/DD/YYYY HH24:MI:SS') order by creation_date desc ;



RDA to run on 8.X version



Copy the RDA from below URL :

1. IMPORTANT: Download latest RDA from Note 314422.1 , alternatively you can use below link:

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=390193761380843&id=314422.1&_afrWindowMode=0&_adf.ctrl-state=17ze6fiyoc_4

important: if you don't have perl you can use the binary version as described in this note

2. Unzip the the file into the SOA Server machine on a location of your preference.

3. From a command prompt enter the command:

./rda.sh -ySCRP -e'RDA.BEGIN.D_ORACLE_PARENT=<MIDDLEWARE_HOME>,OFM.SOA.D_ORACLE_HOME=<SOA_HOME_PATH>,OFM.SOA.D_DOMAIN_ROOT=<DOMAIN_PARENT_PATH>,OFM.SOA.T_DOMAINS=<SOA_DOMAIN_NAME>' -p FM11g_SoaMin

For example the command might look like this:

#PROJECT Specific command

./rda.sh -ySCRP -e'RDA.BEGIN.D_ORACLE_PARENT=/app/oracle/product/fmw/soa,OFM.SOA.D_ORACLE_HOME=/app/oracle/product/fmw/soa/Oracle_SOA1,OFM.SOA.D_DOMAIN_ROOT=/app/oracle/admin/vfq_domain/mserver,OFM.SOA.T_DOMAINS=vfq_domain' -p FM11g_SoaMin


4. Provide the output zip file generated, usually into the same rda folder where above command is ran in the name of: RDA_output_*.zip

Daily Queried to perform purging OSB DB



+++++++++++++++++++++++
p11676998_111130_Generic
+++++++++++++++++++++++

BEGIN
CMS_ORASDPM.UMS_CLEANUP.PURGE(200);
END;
/

+++++++++++++++++++++++
CR325307utility
+++++++++++++++++++++++


DECLARE
amount NUMBER;
BEGIN
REMOVE_REPORT_DATA_OLDER_THAN(50, 1000 ,amount);
dbms_output.put_line(amount);
END;