Thursday, June 23, 2011

How to remove unused files/artifacts from MDS?

          In development phase of project, we will be adding different artifacts to the MDS so that can be accessed by different processes. In course of development /design changes, applying best practices, there is bound to be lot of unused folders /artifacts lying around in the MDS store. So it is always advised to remove the unwanted artifacts, test the processes before we export them to other environments. I always used a workaround to remove the files, even though it was not the best approach.

Workaround
 There is a table called MDS_PATHS where there would be entries corresponding to each artifact. I used to delete the entries from the table and the artifacts never used to show up, even though there will be entries in other related tables.

BestApproach
The best approach/solution is to use WLST command for cleaning up the MDS store. There is a function called deleteMetadata in WLST which will do the job for you.
This is how Oracle documentation describes the command. It deletes the selected documents from the application repository. When this command is run against repositories that support versioning, that is a database-based repository, delete is logical and marks the tip version (the latest version) of the selected documents as "deleted" in the MDS repository partition.
For more attributes and options available with the command refer this doc

The WLST script is located at:

(UNIX) MIDDLEWARE_HOME/ORACLE_SOA1/common/bin/wlst.sh
(Windows) MIDDLEWARE_HOME\Oracle_SOA1\common\bin\wlst.cmd

Once the scripting tool is initialized, Connect to the server

offline>connect(‘username,’pwd’, ‘hostname:7001’)

For running deleteMetada function you need a minimum of 3 inputs
-          application  - since we are deleting from shared artifacts of soa-infra, the value should be soa-infra
-          server -  value should be ‘soa_server1’ or the server u use for SOA other than admin server.
-          docs – the folder path or artifact which you want to delete.

wls:/GEO_domain/serverConfig> deleteMetadata(application='soa-infra',server='soa
_server1',docs='/apps/dvm/oracle/dvm/*')

Executing operation: deleteMetadata.

Operation "deleteMetadata" completed. Summary of "deleteMetadata" operation is:

List of documents successfully deleted:
/apps/dvm/oracle/dvm/GeoXRef.dvm

1 documents successfully deleted.


This will be really useful in all projects as cleanup in mandatory in the MDS. Thanks to jithendra and Ram for their inputs.

Monday, June 13, 2011

File sorting while processing using File/FTP adapter

File Adapter can process files in parallel if there are multiple threads. In case you want a particular order in which the files need to be processes then you must follow guidelines here

For writing custom file sorting algorithms follow the below blog.

Tuesday, June 7, 2011

Avoiding invalid composites at server startup -Abstract V/s Concrete WSDL

One year back I got a chance to help a team working on AIA PIP migration project, the team was stuck with compilation issues of processes that gets migrated to 11g. All processes were using concrete WSDL of dependent processes which were not even ready. That’s when as a best practice we replaced all concrete WSDL’s with Abstract WSDL. Similar issue happens during startup of the server. While loading processes from MDS, there used to be issues related services being unavailable due to the order of process loading. That’s when much emphasis was laid on using Abstract WSDL compared to Concrete WSDL .A nice article on why Abstract WSDL need to be used instead of using concrete WSDL during design time and how it works @ runtime.

Friday, May 27, 2011

How to add/modify BPEL /B2B/Mediator (component) properties – Where it gets stored?


In 11g first release there were properties which could be modified by navigating to $DOMAIN_HOME/soa_domain/config/soa-infra/configuration/ folder. All the config files related to different components used to be present in this folder.
But from subsequent releases the component properties were given an MBean interface for modifying the values. These values get directly updated in the MDS. This blog explains how to modify the values and where in turn it gets stored.
Properties for B2B, BPEL, Mediator, SOA-INFRA, Business rules, Adapter, EDN, workflow can be updated using the Mbeans. I will be taking the example of BPEL properties to show the way.
There are 2 ways of navigating to the properties via MBean.
1.    Soa-infra > Administration >  System MBean Browser



Application Defined MBeans >oracle.as.soainfra.config > Server :soa_server1
>B2BConfig >b2b
>BPELConfig >bpel



2.    Soa-infra > SOA Administration >BPEL Properties


Both the links will lead you to same MBean properties page.


Once you update the value, it gets directly updated in MDS. You can directly go and check in MDS.
Create a MDS connection.
The property files are available in
MDS  -- > soa > configuration >default > bpel –config.xml
                                                >b2b-config.xml
> soa-infra-config.xml
This will help you in verifying whether the values are updated properly.                                         

Wednesday, May 25, 2011

Adding custom jars/classes to Weblogic server -how it works


 One of the queries I got was on how to add custom jars to the weblogic server. This is described in detail in Oracle documentation. I will be just explaining on how it works.
          As you know a domain is a set of WebLogic servers with a central administration point (the Admin Server) and a central configuration repository (config. xml). A managed server is a WebLogic server instance running in a single JVM on a single machine with a targeted set of applications. If you go through the config.xml you will find a list of libraries that need to be loaded and added to the class path. One of them is the oracle extension library named oracle.soa.ext_11.1.1.

Code snippet - Entries from Config.xml

<library>
    <target>AdminServer,soa_server1</target>
    <source-path>D:/Oracle/Middleware/Oracle_SOA1/soa/modules/oracle.soa.ext_11.1.1/oracle.soa.ext.jar</source-path>
    <deployment-order>307</deployment-order>
    <security-dd-model>DDOnly</security-dd-model>
    <staging-mode>nostage</staging-mode>
  </library>

This entry is the handle Weblogic uses to load the custom jars.
How to add custom jars to weblogic domains is described in detail here

Main steps are

  1. Copy the jar files to this directory or its subdirectory.
To add custom jars :
 You can add custom classes and JAR files to an SOA composite application. A SOA extension library for adding extension classes and JARs to an SOA composite application is available in the $ORACLE_HOME/soa/modules/oracle.soa.ext_11.1.1 directory. For Oracle JDeveloper, custom classes and JARs are added to the application_name/project/sca-inf/lib directory.
To add custom classes:
Copy the classes to the classes directory. If the classes are used in bpelx:exec, you must also add the JARs in bpelcClasspath in bpel-config.xml. The bpel-config.xml is stored in soa/  folder in MDS.
  
  1. Run "ant".
  2. Restart Oracle WebLogic Server.
 
How it works ??
Go to $ORACLE_HOME/soa/modules/oracle.soa.ext_11.1.1 directory.
Open the oracle.soa.ext.jar.
The Existing MANIFEST file will look like below.

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 16.0-b13 (Sun Microsystems Inc.)
Implementation-Vendor: Oracle
Implementation-Title: Oracle SOA EXT
Implementation-Version: 11.1.1
Product-Name: Oracle SOA EXT
Product-Version: 11.1.1.3.0
Specification-Version: 11.1.1
Extension-Name: oracle.soa.ext
Class-Path: classes/

To see how it works I created a folder ext and added the jar - geo.soa.ext.jar to ext.
Ran the build file. It re-created the jar with new Manifest file.

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 16.0-b13 (Sun Microsystems Inc.)
Implementation-Vendor: Oracle
Implementation-Title: Oracle SOA EXT
Implementation-Version: 11.1.1
Product-Name: Oracle SOA EXT
Product-Version: 11.1.1.3.0
Specification-Version: 11.1.1
Extension-Name: oracle.soa.ext
Class-Path: ext/geo.soa.ext.jar classes


Restart the server. Observe the logs.


If you see the  oracle.soa.bpel.engine.compiler sets LibClasspath

Log Snippet
[soa_server1] [NOTIFICATION] [] [oracle.soa.bpel.engine.compiler] [tid: weblogic.work.j2ee.J2EEWorkManager$WorkWithListener@3b5c934] [userId: <anonymous>] [ecid: 0000J0Bx98BCgoK_MTk3ye1DpW4f000000,1:20517] [APP: soa-infra] [dcid: 437f5d69399c9ba4:-4506c58d:1300bf5c396:-7ffd-000000000000000e] LibClasspath=D:\Oracle\MIDDLE~1\ORACLE~1\modules\commonj.sdo_2.1.0.jar;D:\Oracle\MIDDLE~1\ORACLE~1\modules\oracle.fabriccommon_11.1.1\fabric-common.jar;D:\Oracle\MIDDLE~1\ORACLE~1\modules\oracle.xdk_11.1.0\xmlparserv2.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.bpel_11.1.1\orabpel-common.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.bpel_11.1.1\orabpel-exts.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.bpel_11.1.1\orabpel-thirdparty.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.bpel_11.1.1\orabpel-validator.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.bpel_11.1.1\orabpel.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.fabric_11.1.1\fabric-client.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.fabric_11.1.1\fabric-ext.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.fabric_11.1.1\fabric-runtime.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.fabric_11.1.1\oracle.soa.fabric.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.fabric_11.1.1\soa-infra-tools.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.ext_11.1.1\ext/geo.soa.ext.jar;D:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.ext_11.1.1\classes;D:\Oracle\MIDDLE~1\ORACLE~1\soa\modules\oracle.soa.mgmt_11.1.1\soa-infra-mgmt.jar


The custom jars/classes are loaded at server startup so that the jars are available during runtime. Thanks to Siva for his inputs.