Archive for September, 2011

Oracle SOA Suite 11g–Windows 2003 issue

Recently when i tried to start the WLS sever after fresh installation, i have got the following error:

[WARN ][osal   ] could not enumerate processors (1) error=-1073738824
[WARN ][osal   ] Failed to init system load counters
The domain has both SOA and OSB managed servers in a machine where the OS is Windows 2003 server.
JRockit JVM is used while creating the domain.
After a little research found out that it’s one of the known issues when using the JRockit JVM on windows. 
The following link gives the workaround for this problem.
http://download.oracle.com/docs/cd/E15289_01/doc.40/e15066/knownissues.htm#CJAHCBDA
In my case, i just switched on  to Sun JVM by modifying setDomainEnv.cmd file.
Advertisement

Coherence in BPEL11g

After trying out with Result Caching feature in OSB, i tried to use the coherence in integration with BPEL to store and retrieve the frequently used data in cache. As OTN puts it, “Coherence provides replicated and distributed (partitioned) data management and caching services on top of a reliable, highly scalable peer-to-peer clustering protocol”. In this post, i want to explain the setup i tried with using SOA Suite 11.1.1.3. The weblogic 10.3.3 installer comes with coherence 3.5

Starting Servers

To use coherence in conjunction with BPEL, the servers have to be started in the following order:

    • Coherence server (cache-server.cmd)
    • Admin and SOA managed server.

Open cache-server.cmd file present in $FMW_HOME\coherence_3.5\bin and set the coherence_home variable as shown below. Replace $FMW_HOME with actual path as per your SOA suite installation.

       set coherence_home = $FMW_HOME\coherence_3.5

Open command window and issue the following commands to start the cache server.

    $<DOMAIN_HOME>\bin\setDomainEnv.cmd or set $JAVA_HOME

    set %PATH% = %JAVA_HOME%\bin;%PATH%

    cache-server.cmd

By default, multicasting is used for communication within coherence cluster. The multicast address and port will be visible in cache server start logs as shown below.

          image

In setDomainEnv.cmd file, modify EXTRA_JAVA_PROPERTIES variable to use above multicast address and port.

       image

In startWeblogic.cmd file, modify CLASSPATH variable to include coherence jar in server classpath.

SOA Composite Creation

We will create a simple BPEL process to demonstrate the use of coherence API to store and retrieve cache entries.

Create a sample SOA project in JDeveloper. Add coherence.jar to project libraries which can be found at location $FMW_HOME\coherence_3.5\lib. Create a BPEL process that accepts a string and returns another string.

        clip_image002

Create a java embedding activity with following code to verify whether the cache contains a value or not.

String cacheToken= ((oracle.xml.parser.v2.XMLElement) getVariableData ("varInput","payload","/client:process/client:input")).getFirstChild().getNodeValue();

//create new cache or to get the existing cache

NamedCache cache = CacheFactory.getCache("myCache");

//verify whether the key exists or not

setVariableData("valExists", cache.containsKey(cacheToken));

setVariableData("var1", cache.get(cacheToken));

Create a switch case in BPEL flow to call the actual service if the cache value does not exist for the token used. The following expression can be used in the switch case.

      bpws:getVariableData(‘valExists’)=string(true())

If the value is retrieved from cache, copy the value stored in ‘var1’ variable to output variable and do reply from BPEL process. Otherwise store the value we have got from the actual service in cache by using another java embedding activity with following code.

String cacheToken= ((oracle.xml.parser.v2.XMLElement) getVariableData("varInput","payload","/client:process/client:input")).getFirstChild().getNodeValue();

String cacheValue= ((oracle.xml.parser.v2.XMLElement) getVariableData("InvokeOutputVariable","parameters","/ns1:getResponse/val")).getFirstChild().getNodeValue();

NamedCache cache = CacheFactory.getCache("myCache");

cache.put(cacheToken,cacheValue);

setVariableData("var1",cache.get(cacheToken));

Execution of BPEL:

When result is not in Cache:

Run the BPEL by giving the value for ‘input’ element that does not exist in the cache currently. Here in this case, we are sending it as ‘NewUser’.

       image

         image

Observe that partner link has been called to get the result.

        image

When result is in Cache:

          image

Observe that partner link is not called and the result is fetched from the cache as expected.

          image

Strategies to Flush/Refresh the Cache:

  • Create a configuration parameter or BPEL property to specify whether cache has to be cleared or not. Modify the above switch condition to include this OR condition so that the existing cache will be reset by fetching the value again by calling the partner link.
  • Restarting the coherence server.

Pages

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 379 other subscribers

Enter your email address to follow this blog and receive notifications of new posts by email.


%d bloggers like this: