Wednesday Jan 30, 2013

Accessing Coherence from OSB Pipeline

I recently got an request from customer that they want to invalidate the data in OSB ResultCache. As there is no way that we can create Key to invalidate the data, best way we can take is using filter. Here is the snippet of the code. 

 extern "C" void invalidate(char* key) {

    try {

        String::View vsCacheName = "/osb/service/ResultCache";

        NamedCache::Handle hCache = CacheFactory::getCache(vsCacheName);

        ValueExtractor::Handle hExtractor = KeyExtractor::create(ReflectionExtractor::create("getToken"));

        Filter::View vEqualsFilter = EqualsFilter::create(hExtractor, String::create(key));

        hCache->invokeAll(vEqualsFilter, ConditionalRemove::create(AlwaysFilter::getInstance(),true));

    } catch (const std::exception& e) {

        std::cerr << "error: " << e.what() << std::endl;

    }

}

One issue here is that we cannot specify which result of BusinessService should be invalidated. If two BusinessServices happen to have same token, This will remove both of them which sometimes is not desirable. Also, Index is not in place, so if size of cache is huge, we would expect the performance issue.Currently, I'm not aware of any way to make Key class. I tried making it by myself, but somehow, the one I make and generated by OSB is different.so I ended up making my own ResultCache logic to achieve this purpose.

--

public class ResultCacheHelper {
 private static String CACHE_NAME = "dist-test";
 
 public static void put(String key, org.apache.xmlbeans.XmlObject value) throws IOException {
 NamedCache cache = CacheFactory.getCache(CACHE_NAME);
 cache.put(key, serialize(value));
 CacheFactory.log("Cache Key : " + key + " is put in Cache!:" + serialize(value).toString());
 }
 
 public static org.apache.xmlbeans.XmlObject get(String key) throws IOException, ClassNotFoundException, XmlException {
 XmlObject result;
 NamedCache cache = CacheFactory.getCache(CACHE_NAME);
 
 byte[] bytes = (byte[]) cache.get(key);
 if(bytes == null) {
 String xmlNull = "<cache xmlns=\"http://com.oracle.demoapp.ws/\">null</cache>";
 result = org.apache.xmlbeans.XmlObject.Factory.parse(xmlNull);
 CacheFactory.log("Cache Key : " + key + " is not found in Cache!");
 } else  {
 result = (org.apache.xmlbeans.XmlObject)deserialize(bytes, Thread.currentThread().getContextClassLoader());
 CacheFactory.log("Cache Key : " + key + " is found in Cache!:"+result.toString());
 }
 
 return result;
 }
 
 protected static Object deserialize(byte[] bytes, final ClassLoader cl)
 throws IOException, ClassNotFoundException {
 ObjectInputStream ois = null;
 try {
 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
 ois = new ObjectInputStream(bais) {
 protected Class<?> resolveClass(ObjectStreamClass desc)
 throws IOException, ClassNotFoundException {
 return Class.forName(desc.getName(), false, cl);
 }
 };
 return ois.readObject();
 } finally {
 if (ois != null)
 ois.close();
 }
 }
 protected static byte[] serialize(Object object) throws IOException {
 ObjectOutputStream oos = null;
 try {
 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 oos = new ObjectOutputStream(baos);
 oos.writeObject(object);
 return baos.toByteArray();
 } finally {
 if (oos != null)
 oos.close();
 }
 }
}

--


Now I can just simply invalidate the cache

        String::View deleteKey = key;

        String::View vsCacheName = "dist-test";

        NamedCache::Handle hCache = CacheFactory::getCache(vsCacheName);

        hCache->remove(deleteKey);

 I believe that OSB invalidation feature will be added in near future. 

Friday Aug 10, 2012

Google MAP APIv3 with ADF

James Taylor wrote nice sample code for integrating Google Map with ADF. Unfortunately, As Google Map API has been upgraded to v3, we need to make a little bit of changes to get it working. Here is the sample code.

     <f:facet name="metaContainer">

        <af:resource type="javascript" source="https://www.google.com/jsapi?key=[API  Key]"/> 

          <af:resource type="javascript">

  google.load("maps", "3",  {other_params:"sensor=false"});

  var map;

  var marker;

  function initialize() {

    var myLatlng = new google.maps.LatLng(-34.397, 150.644);

    var myOptions = {

      zoom: 8,

      center: myLatlng,

      mapTypeId: google.maps.MapTypeId.ROADMAP

    }

    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  }

  google.setOnLoadCallback(initialize);

          </af:resource>

        <af:resource type="javascript"> 

                          function doNavigate(evt) 

                          { long = evt.getSource().getProperty("long"); 

                            lat = evt.getSource().getProperty("lat");

                            var center = new google.maps.LatLng(lat, long);

                            map.setZoom(15);

                            map.setCenter(center);

                            marker = new google.maps.Marker({position: center,map: map});

                            marker.setMap(map);

                          } 

        </af:resource> 

        </f:facet>

Tuesday Oct 04, 2011

Coherence*Web Session clustering between WebSphere and WebLogic

Briefly describing the needed steps to share session information between WebSphere 6.x and WebLogic 10.x

Steps for WLS 

1. java -cp coherence.jar;coherence-web.jar com.tangosol.coherence.servlet.WebPluginInstaller [WLS_HOME] -install

2. java -jar webInstaller.jar SessionTest.war -inspect -server:WebLogic/10.x

3. Modify coherence-web.xml 
    <param-name>coherence-session-cookie-domain</param-name>
    <param-value>.test.com</param-value>

<param-name>coherence-session-cookie-path</param-name>
    <param-value>/</param-value>

<param-name>coherence-servletcontext-clustered</param-name>
    <param-value>true</param-value>

    <param-name>coherence-enable-sessioncontext</param-name>
    <param-value>true</param-value>

<param-name>coherence-scopecontroller-class</param-name>
    <param-value>
       com.tangosol.coherence.servlet.AbstractHttpSessionCollection$GlobalScopeController
    </param-value>
<param-name>coherence-session-id-length</param-name>
    <param-value>32</param-value>

3. java -jar webInstaller.jar SessionTest.war -install

4. Insert those two classes(MyCookieHelper, MyDefaultFactory) into the SessionTest.war file.
----------------------------------------------------
package com.tangosol.coherence.servlet.weblogic81;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import com.oracle.FileLogWriter;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.cache.LocalCache;

public class MyCookieHelper extends CookieHelper {
// protected static final char SUFFIX_SEPARATOR = 46;
private LocalCache m_cacheFailover;
private String m_sConfiguredJvmRoute;
private FileLogWriter fileWriter;
public MyCookieHelper(
com.tangosol.coherence.servlet.SessionHelper.Factory factory,
ServletContext ctx) {
this(factory, ctx, null);
}

public MyCookieHelper(
com.tangosol.coherence.servlet.SessionHelper.Factory factory,
ServletContext ctx, String sJvmRoute) {
super(factory, ctx);
fileWriter = new FileLogWriter();
m_cacheFailover = new LocalCache(128);
m_sConfiguredJvmRoute = sJvmRoute;
}

public String decodeCookie(HttpServletRequest req) {
String sSessionId = super.decodeCookie(req);
CacheFactory.log("before :" + sSessionId);
fileWriter.writeToFile("before :" + sSessionId);
// WebLogic Session
if (sSessionId != null) {
int ofSeparator = sSessionId.indexOf('!');
if (ofSeparator >= 0) {
String sServerSuffix = getWebLogicAffinitrySuffix();
String sSessionSuffix = sSessionId.substring(ofSeparator);
sSessionId = sSessionId.substring(0, ofSeparator);
if (!sSessionSuffix.equals(sServerSuffix))
m_cacheFailover.put(sSessionId, sSessionSuffix);
}
}

// WebSphere Session
if ((sSessionId != null) && (sSessionId.length() > 4) &&(sSessionId.startsWith("0000"))) {
sSessionId = sSessionId.substring("0000".length());

int ofSeparator = sSessionId.indexOf(getWebSphereAffinitySuffix());
if (ofSeparator >= 0) {
String sServerSuffix = getWebSphereAffinitySuffix();
String sSessionSuffix = sSessionId.substring(ofSeparator);
sSessionId = sSessionId.substring(0, ofSeparator);

if (!sSessionSuffix.equals(sServerSuffix)) {
this.m_cacheFailover.put(sSessionId, sSessionSuffix);
}
}
}
CacheFactory.log("after :" + sSessionId);
fileWriter.writeToFile("before :" + sSessionId);
return sSessionId;
}

public String decodeUrl(HttpServletRequest request) {
String sSessionId = super.decodeUrl(request);
CacheFactory.log("before :" + sSessionId);
fileWriter.writeToFile("before :" + sSessionId);
if (sSessionId != null) {
int ofSeparator = sSessionId.indexOf('!');
if (ofSeparator >= 0)
sSessionId = sSessionId.substring(0, ofSeparator);
}
   if ((sSessionId != null) && (sSessionId.length() > 4) && (sSessionId.startsWith("0000")))
   {
     sSessionId = sSessionId.substring("0000".length());

     int ofSeparator = sSessionId.indexOf(getWebSphereAffinitySuffix());
     if (ofSeparator >= 0)
     {
       sSessionId = sSessionId.substring(0, ofSeparator);
     }
   }
   CacheFactory.log("after :" + sSessionId);
   fileWriter.writeToFile("before :" + sSessionId);
return sSessionId;
}

public String getWebSphereAffinitySuffix() {
return ":";
}

public String getWebLogicAffinitrySuffix() {
return "!";
}
}
----------------------------------------------------
package com.tangosol.coherence.servlet.weblogic103;

import com.tangosol.coherence.servlet.SessionHelper;
import com.tangosol.coherence.servlet.weblogic81.MyCookieHelper;
import javax.servlet.ServletContext;
import com.tangosol.net.CacheFactory;

public class MyDefaultFactory  extends DefaultFactory {

    public SessionHelper instantiateSessionHelper(ServletContext ctx) {
        CacheFactory.log(toString() + ": creating SessionHelper");
        azzert(ctx != null);
        azzert(getServletContext() == null && getSessionHelper() == null);
        String sJvmRoute = System.getProperty("jvmRoute", (String)ctx.getAttribute("coherence-jvmroute"));
        MyCookieHelper helper = new MyCookieHelper(this, ctx, sJvmRoute);
        setServletContext(ctx);
        setSessionHelper(helper);
        return helper;
    }
}
----------------------------------------------------

5. Modify the web.xml.
<param-name>coherence-factory-class</param-name>
    <param-value>com.tangosol.coherence.servlet.weblogic103.MyDefaultFactory</param-value>

Steps for WebSphere

Basically steps are very similar with WebLogic part except helper classes.

1. java -jar webInstaller.jar SessionTest.war -inspect -server:WebSphere/6.x

2. Modify coherence-web.xml
    <param-name>coherence-session-cookie-domain</param-name>
    <param-value>.test.com</param-value>

<param-name>coherence-session-cookie-path</param-name>
    <param-value>/</param-value>

<param-name>coherence-servletcontext-clustered</param-name>
    <param-value>true</param-value>

    <param-name>coherence-enable-sessioncontext</param-name>
    <param-value>true</param-value>

<param-name>coherence-scopecontroller-class</param-name>
    <param-value>
       com.tangosol.coherence.servlet.AbstractHttpSessionCollection$GlobalScopeController
    </param-value>
<param-name>coherence-session-id-length</param-name>
    <param-value>32</param-value>

3. java -jar webInstaller.jar SessionTest.war -install

4. Insert those two classes(MyCookieHelper, MyDefaultFactory) into the SessionTest.war file.
----------------------------------------------------
package com.tangosol.coherence.servlet.websphere60;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import com.oracle.FileLogWriter;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.cache.LocalCache;

public class MyCookieHelper extends com.tangosol.coherence.servlet.websphere60.CookieHelper {
protected static final char SUFFIX_SEPARATOR = 46;
private LocalCache m_cacheFailover;
private String m_sConfiguredJvmRoute;
private FileLogWriter fileWriter;
public MyCookieHelper(
com.tangosol.coherence.servlet.SessionHelper.Factory factory,
ServletContext ctx) {
this(factory, ctx, null);
}

public MyCookieHelper(
com.tangosol.coherence.servlet.SessionHelper.Factory factory,
ServletContext ctx, String sJvmRoute) {
super(factory, ctx);
fileWriter = new FileLogWriter();
m_cacheFailover = new LocalCache(128);
m_sConfiguredJvmRoute = sJvmRoute;
}

public String decodeCookie(HttpServletRequest req) {
String sSessionId = super.decodeCookie(req);
CacheFactory.log("before :" + sSessionId);
fileWriter.writeToFile("before :" + sSessionId);
// WebLogic Session
if (sSessionId != null) {
int ofSeparator = sSessionId.indexOf('!');
if (ofSeparator >= 0) {
String sServerSuffix = getWebLogicAffinitrySuffix();
String sSessionSuffix = sSessionId.substring(ofSeparator);
sSessionId = sSessionId.substring(0, ofSeparator);
if (!sSessionSuffix.equals(sServerSuffix))
m_cacheFailover.put(sSessionId, sSessionSuffix);
}
}

// WebSphere Session
if ((sSessionId != null) && (sSessionId.length() > 4) && (sSessionId.startsWith("0000"))) {
sSessionId = sSessionId.substring("0000".length());

int ofSeparator = sSessionId.indexOf(getWebSphereAffinitySuffix());
if (ofSeparator >= 0) {
String sServerSuffix = getWebSphereAffinitySuffix();
String sSessionSuffix = sSessionId.substring(ofSeparator);
sSessionId = sSessionId.substring(0, ofSeparator);

if (!sSessionSuffix.equals(sServerSuffix)) {
this.m_cacheFailover.put(sSessionId, sSessionSuffix);
}
}
}
CacheFactory.log("after :" + sSessionId);
fileWriter.writeToFile("before :" + sSessionId);
return sSessionId;
}

public String decodeUrl(HttpServletRequest request) {
String sSessionId = super.decodeUrl(request);
CacheFactory.log("before :" + sSessionId);
fileWriter.writeToFile("before :" + sSessionId);
if (sSessionId != null) {
int ofSeparator = sSessionId.indexOf('!');
if (ofSeparator >= 0)
sSessionId = sSessionId.substring(0, ofSeparator);
}
   if ((sSessionId != null) && (sSessionId.length() > 4) && (sSessionId.startsWith("0000")))
   {
     sSessionId = sSessionId.substring("0000".length());

     int ofSeparator = sSessionId.indexOf(getWebSphereAffinitySuffix());
     if (ofSeparator >= 0)
     {
       sSessionId = sSessionId.substring(0, ofSeparator);
     }
   }
   CacheFactory.log("after :" + sSessionId);
   fileWriter.writeToFile("before :" + sSessionId);
return sSessionId;
}

public String getWebSphereAffinitySuffix() {
return ":";
}

public String getWebLogicAffinitrySuffix() {
return "!";
}
}
----------------------------------------------------
package com.tangosol.coherence.servlet.websphere60;

import javax.servlet.ServletContext;

import com.tangosol.coherence.servlet.SessionHelper;
import com.tangosol.coherence.servlet.websphere60.DefaultFactory;
import com.tangosol.coherence.servlet.websphere60.MyCookieHelper;
import com.tangosol.net.CacheFactory;

public class MyDefaultFactory   extends com.tangosol.coherence.servlet.websphere60.DefaultFactory {
public MyDefaultFactory() {
}
    public SessionHelper instantiateSessionHelper(ServletContext ctx) {
        CacheFactory.log(toString() + ": creating SessionHelper");
        azzert(ctx != null);
        azzert(getServletContext() == null && getSessionHelper() == null);
        String sJvmRoute = System.getProperty("jvmRoute", (String)ctx.getAttribute("coherence-tomcat-jvmroute"));
        MyCookieHelper helper = new MyCookieHelper(this, ctx, sJvmRoute);
        setServletContext(ctx);
        setSessionHelper(helper);
        return helper;
    }
}
----------------------------------------------------

5. Modify the web.xml. 
    <param-name>coherence-factory-class</param-name>
    <param-value>com.tangosol.coherence.servlet.websphere60.MyDefaultFactory</param-value>


Sunday Sep 18, 2011

Accessing Coherence Cluster Using Spring Bean on SOA SUITE 11g

Following solution was tested on SOA SUITE 11.1.1.4 with Coherence 3.6.0. There might be other way like below to access coherence cluster from SOA SUITE.

https://forums.oracle.com/forums/thread.jspa?threadID=2268739&tstart=180

Background:

Coherence cache-config is pre-defined for SOA Cluster, and all SOA composite application will inherit this. This cache-config is zipped in fabric-runtime.jar as name of soa-coherence-cache-config.xml(This can be observed with logs from clustered managed server) And tangosol-coherence-override.xml is also included in fabric-runtime.jar and enforce SOA server to use cache-config included in fabric-runtime.jar(As a result, -Dtangosol.coherence.cacheconfig in setDomainEnv cannot precede this)

I've tried out several options to make the whole thing work and this is what I found relatively cleaner solution than others. I will use Coherence*Extend and Spring Bean in SOA SUITE 11g.

Steps:

1. Extract tangosol-coherence-override.xml and soa-coherence-cache-config.xml from fabric-runtime.jar($WLS_HOME/Oracle_SOA1/soa/modules/oracle.soa.fabric_11.1.1/fabric-runtime.jar)

Edit  the tangosol-coherence-override.xml file.

CHANGE the cache-config param to locate your own cache-conifg file. This have to be created based on the soa-coherence-cache-config.xml included in fabric-runtime.jar. THIS FILE WILL BE USED IN STEP 2.

 Add the remote-scheme in the soa-coherence-cache-config.xml file.

2. Go to SOA Domain HOME, and modify setDomainEnv.sh. SET -Dtangosol.coherence.override to the file we extracted and modified in step1.

3. Configure Coherence Cluster to have TCP*Extend proxy. (This is simple enough, so omitted for brevity)

4. We will use Spring Bean instead of Java Embedding for coding convenience. In SOA project, create one interface and one class. as below.

5. Drag&Drop Spring Context from Component Palette to Composite Diagram, Select 'Create New Context' to create new spring bean context file.Open up newly created file.

 And drag&drop "Service" from right pane. After you add Service, bean definition will be created.

6. Wire BPEL(or Mediator) to Spring Context and Implement it appropriately(Add 'ASSIGN' and 'INVOKE')

7. It's all set to go now. Just one more trivial thing to do is, add 'wlfullclient.jar' and 'jps-internal.jar' into CLASSPATH of Coherence cache servers, so it won't complaint about "ClassNotFound"

 There might be more nicer way than this. I'll be looking for it.

Composite Invocation Changed from PS4(11.1.1.5)

As described in
http://download.oracle.com/docs/cd/E21043_01/apirefs.1111/e10659/oracle/soa/management/facade/Service.html#post_java_lang_String__oracle_fabric_common_NormalizedMessage_


Service invocation using oracle.soa.management.facade.Service is deprecated from PS4.

Instead, oracle.soa.api.DirectConnection is recommended further on. Here is the basic sample code:

try {

String operationName = "process";

String xml = "<ns1:process xmlns:ns1=\"http://xmlns.oracle.com/BPMTestApp/InvokeSOATest/AsyncBPEL\"><ns1:input></ns1:input></ns1:process>";


// domainName, compositeName, revision

CompositeDN compositeDN = new CompositeDN("default",

"InvokeSOATest", "1.0");

// DirectConnection - oracle-soa-client-api.jar

Locator compositeLocator = null;


Hashtable<String, String> jndiProps = new Hashtable();

jndiProps.put(Context.PROVIDER_URL,

"t3://jlee-soa11:7001/soa-infra");

jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,

"weblogic.jndi.WLInitialContextFactory");

jndiProps.put(Context.SECURITY_PRINCIPAL, "weblogic");

jndiProps.put(Context.SECURITY_CREDENTIALS, "welcome1");


compositeLocator = LocatorFactory.createLocator(jndiProps);

// compositeDN, serviceName

DirectConnection dic = compositeLocator.createDirectConnection(

compositeDN, "DirectBinding");


// create a std dom parser

DOMParser parser = new DOMParser();

parser.parse(new InputSource(new StringReader(xml)));


Element element = parser.getDocument().getDocumentElement();

Map<String, Element> payload = new HashMap<String, Element>();

payload.put("payload", element);

Message<Element> xmlMessage = XMLMessageFactory.getInstance()

.createMessage(payload);


dic.post(operationName, xmlMessage);

} catch (Exception e) {

e.printStackTrace();

}


hope this helps.

Thursday Jun 03, 2010

JRockit Virtual Edition Debug Key

There are a few keys that can help the debugging of the JRVE env in console. you can type in each keys in JRVE console to see what's happening under the hood.

key '0' : System information
key '5' : Enable shutdown
key '7' : Start JRockit Management Server (port 7091)
key '8' : Statistics Counters
key '9' : Full Thread Dump
key '0' : Status of Debug-key

Below is the sample out from each keys.

Debug-key '1' pressed

============ JRockitVE System Information ============
JRockitVE version : 11.1.1.3.0-67-131044
Kernel version : 6.1.0.0-97-131024
JVM version : R27.6.6-28_o-125824-1.6.0_17-20091214-2104-linux-ia32
Hypervisor version : Xen 3.4.0
Boot state : 0x007effff
Uptime : 0 days 02:04:31
CPU : uniprocessor @2327 Mhz
CPU usage : 0% ctx/s: 285 preempt/s: 0 migrations/s: 0
Physical pages : 82379/261121 (321/1020 MB)
Network info : 10.179.97.64 (10.179.97.64/255.255.254.0)
GateWay : 10.179.96.1
MAC address : 00:16:3e:7e:dc:78
Boot options :
vfsCwd : /application/user_projects/domains/wlsve_domain
mainArgs : java -javaagent:/jrockitve/services/sshd/sshd.jar -cp /jrockitve/jrockit/lib/tools.jar:/jrockitve/lib/common.jar:/application/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/application/wlserver_10.3/server/lib/weblogic.jar -Dweblogic.Name=WlsveAdmin -Dweblogic.Domain=wlsve_domain -Dweblogic.management.username=weblogic -Dweblogic.management.password=welcome1 -Dweblogic.management.GenerateDefaultConfig=true weblogic.Server
consLog : /jrockitve/log/jrockitve.log
mounts : ext2 / dev0;
posixLocale : en_US
posixTimezone : Asia/Seoul
posixEncoding : ISO-8859-1
Local disk : Size: 1024M, Used: 728M, Free: 295M
========================================================

Debug-key '5' pressed
Shutdown enabled.

Debug-key '7' pressed
[JRockit] Management server already started. Ignoring request.

Debug-key '8' pressed
Starting stat recording
Debug-key '8' pressed
========= Statistics Counters for the last second =========
dev.eth0_rx.cnt : 22 packets
dev.eth0_rx_bytes.cnt : 2704 bytes
dev.net_interrupts.cnt : 22 interrupts
evt.timer_ticks.cnt : 123 ticks
hyper.priv_entries.cnt : 144 entries
schedule.context_switches.cnt : 271 switches
schedule.idle_cpu_time.cnt : 997318849 nanoseconds
schedule.idle_cpu_time_0.cnt : 997318849 nanoseconds
schedule.total_cpu_time.cnt : 1000031757 nanoseconds
time.system_time.cnt : 1000 ns
time.timer_updates.cnt : 123 updates
time.wallclock_time.cnt : 1000 ns
=======================================

Debug-key '9' pressed

===== FULL THREAD DUMP ===============
Fri Jun 4 08:22:12 2010
BEA JRockit(R) R27.6.6-28_o-125824-1.6.0_17-20091214-2104-linux-ia32

"Main Thread" id=1 idx=0x4 tid=1 prio=5 alive, in native, waiting
-- Waiting for notification on: weblogic/t3/srvr/T3Srvr@0x646ede8[fat lock]
at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)
at java/lang/Object.wait(J)V(Native Method)
at java/lang/Object.wait(Object.java:485)
at weblogic/t3/srvr/T3Srvr.waitForDeath(T3Srvr.java:919)
^-- Lock released while waiting: weblogic/t3/srvr/T3Srvr@0x646ede8[fat lock]
at weblogic/t3/srvr/T3Srvr.run(T3Srvr.java:479)
at weblogic/Server.main(Server.java:67)
at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
-- end of trace

"(Signal Handler)" id=2 idx=0x8 tid=2 prio=5 alive, in native, daemon

Open lock chains
================
Chain 1:
"ExecuteThread: '0' for queue: 'weblogic.socket.Muxer'" id=23 idx=0x50 tid=20 waiting for java/lang/String@0x630c588 held by:
"ExecuteThread: '1' for queue: 'weblogic.socket.Muxer'" id=24 idx=0x54 tid=21 (active)

===== END OF THREAD DUMP ===============

Debug-key '0' pressed

Debug-keys enabled


Happy Cloud Walking :)

Sunday Feb 21, 2010

OracleVM Command Line Interface Installation

This is simple steps to follow when you install the OVM CLI on fresh installed OVM.

1. add oracle public yum server
# wget http://public-yum.oracle.com/public-yum-el5.repo
(set http_proxy when it's needed. ex. export http_proxy=http://localhost:80)

2. edit public-yum-el5.repo
search for el5_addons entry. there are two addons, one is el_5addons, and another one is el5_oracle_addons. change the value of enabled from 0 to 1 to enable the both entries.

3. install ovmcli
# yum install ovmcli

cool thing about yum is that it handles the dependencies automatically, so you would easily avoid the possible hassles.

Monday Nov 30, 2009

libnnz10.so missing when executing ggsci on Linux

I came across the error like following when I executed ggsci on OEL:

[oracle@jlee-oss ggsource1]$ ./ggsci
./ggsci: error while loading shared libraries: libnnz10.so: cannot open shared object file: No such file or directory

those are libraries which are located in ORACLE_HOME. so, this can be easily solved using soft link.

[oracle@jlee-oss ggsource1]$ ln -s /home/oracle/product/10.2.0/db_1/lib32/libnnz10.so libnnz10.so

plus one more link as below.

[oracle@jlee-oss ggsource1]$ ln -s /home/oracle/product/10.2.0/db_1/lib32/libclntsh.so.10.1 libclntsh.so.10.1

When using 64bit, change the lib path (lib32 to lib64) above to the appropriate one.
happy replicating!

Tuesday Nov 17, 2009

Stuck at Blank Screen when installing OEL5 on Dell Optiplex 745?

Have anyone got an issue that screen goes blank just after running anaconda when installing OEL5 on Optiplex 745?
there is simple solution for this(god, I spent almost 2hours to figure this out :-( )
I saw on mailing list that there is a known issue with auto-probing video driver. so
first tried with "linux noprobe" and then guess what? I couldn't even type on my keyboard.

Solution is pretty simple as below.
On Grub command, Type like this : linux xdriver=vesa

then it will go smoothly without seeing any dumb blank screen.

Monday Sep 28, 2009

Creating domain only for ADF with SOA 11g

For whom are interested in playing with ADF and already got SOA11g installed, it would be good to have test ballpark only for ADF (excluding all SOA related components).

here is very good pointer for the people like me.

http://blogs.oracle.com/olaf/2009/04/upgrading_your_weblogic_to_adf_3.html

Start the step from No 5.

Good Luck!!

---- post edit
if you come across the weird ClassNotFoundException during your deployment from jdev,
put adfm.jar, adfmweb.jar, adfdt_common.jar, bc4j-mbeans.jar into ${domain_home$}/lib.

after restart the server, it should be fine. I gotta find the elegant way to handle this issue.

reference : http://forums.oracle.com/forums/thread.jspa?messageID=3379961
http://one-size-doesnt-fit-all.blogspot.com/2009/01/configuring-weblogic-server.html

Tuesday Sep 01, 2009

Task Detail page sample for 11g

I've come across many customers who want to customize the HW detail page for their own. In this post, I'll attach the very basic page u can use, so you don't have to start it from scratch.

sample jsp as below:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<%@ page contentType="text/html;charset=EUC-KR"%>

<%@ page import="java.util.*,oracle.bpel.services.workflow.client.IWorkflowServiceClientConstants,com.oracle.jay.WorklistClient,oracle.bpel.services.workflow.client.IWorkflowServiceClient, oracle.bpel.services.workflow.verification.IWorkflowContext,oracle.bpel.services.workflow.client.WorkflowServiceClientFactory,oracle.bpel.services.workflow.query.ITaskQueryService,oracle.bpel.services.workflow.task.model.Task"%>

<html>

  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"/>

    <title>taskdetailtest</title>

  </head>

  <body>

    <%

    

    String bpmWorklistTaskId = request.getParameter("bpmWorklistTaskId");

    String bpmWorklistContext = request.getParameter("bpmWorklistContext");

    

Map<IWorkflowServiceClientConstants.CONNECTION_PROPERTY,java.lang.String>

properties = new

HashMap<IWorkflowServiceClientConstants.CONNECTION_PROPERTY,java.lang.String>();


properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.MODE, IWorkflowServiceClientConstants.MODE_DYNAMIC);


properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL, "t3://localhost:8001");


properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_CREDENTIALS, "welcome1");


properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_PRINCIPAL, "weblogic");


IWorkflowServiceClient client = WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT, properties, null);


IWorkflowServiceClient wfSvcClient =

WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.SOAP_CLIENT,

properties, null);


    //IWorkflowServiceClient wfSvcClient = WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.JAVA_CLIENT);

    IWorkflowContext ctx = null;

    ITaskQueryService querySvc = wfSvcClient.getTaskQueryService();

    ctx = querySvc.getWorkflowContext(bpmWorklistContext);

    

    Task humanTask = querySvc.getTaskDetailsById(ctx, bpmWorklistTaskId);

    

    out.println("<br>Task Number: " + humanTask.getSystemAttributes().getTaskNumber());

    out.println("<br>Task Id: " + humanTask.getSystemAttributes().getTaskId());

    out.println("<br>Title: " + humanTask.getTitle());

    out.println("<br>Pri ority: " + humanTask.getPriority());

    out.println("<br>State: " + humanTask.getSystemAttributes().getState());

    out.println();

  %>

  </body>

</html>


once you are done with the page, you have to change the url link that redirect to the detailed page when you click on the worklist application.

go to em first, right click on soa-infra, drill into service-engines and Human Workflow. 

snap040.jpg


click the HumanTask and then,


snap041.jpg


change the URI to point the page u made before. 
Good Luck!

[Read More]

HWF in 11g

I recognize that there are few changes made from 10g Worklist API to 11g. I've tried figuring out how I can use it in 11g just like old days, and finally got my sample code working successfully. here I'll describe the basic things to use HWF in 11g.

in 10g, we have to have wf_client_config.xml in classpath to set the soap endpoints and ejb lookup properties which is used by worklist client. in 11g, you have two choices. just like old days, you can have wf_client_config.xml, or you can hand properties to Factory which precede the configuration file.

Speaking about Properties, we're using oracle.bpel.services.workflow.client.IWorkflowServiceClientConstants to set the connection properties. look at the simple example below:


Map
properties = new
HashMap();

properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.MODE, IWorkflowServiceClientConstants.MODE_DYNAMIC);

properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL, "t3://localhost:8001");

properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_CREDENTIALS, "welcome1");

properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_PRINCIPAL, "weblogic");

IWorkflowServiceClient wfSvcClient =
WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT,
properties, null);

IWorkflowContext ctx = null;
ITaskQueryService querySvc = wfSvcClient.getTaskQueryService();


and configuration file, u can use the sample as below:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<workflowServicesClientConfiguration xmlns="http://xmlns.oracle.com/bpel/services/client">

  <server name="default" default="true">

    <localClient>

        <participateInClientTransaction>false</participateInClientTransaction>

    </localClient>

    <remoteClient>

         <serverURL>t3://localhost:7001</serverURL>

    <userName>weblogic</userName>

         <password>weblogic</password>

         <initialContextFactory>weblogic.jndi.WLInitialContextFactory</initialContextFactory>

         <participateInClientTransaction>false</participateInClientTransaction>

    </remoteClient>

    <soapClient>

        <rootEndPointURL>http://localhost:7001</rootEndPointURL>

        <identityPropagation mode="dynamic" type="saml">

            <policy-references>

                <policy-reference enabled="true" category="security" uri="oracle/wss10_saml_token_client_policy"/>

            </policy-references>

        </identityPropagation>

    </soapClient>

  </server>  

</workflowServicesClientConfiguration>

store it as wf_client_config.xml and put it under the classpath.

I've tried SOAP_CLIENT with no success yet. once I find the answer, I'll share this,too.

[Read More]

Monday Aug 17, 2009

Mediator JavaCallout Sample

Here is the sample code for the Mediator JavaCallout. be cautious that
if there is an Runtime Exception raised inside your Callout class, your composite
never get invoked.

sample code:

public class CalloutTest extends AbstractJavaCalloutImpl {
public CalloutTest() {
}

public void initialize(Logger logger) throws MediatorCalloutException {
}


public boolean preRouting(CalloutMediatorMessage message) throws MediatorCalloutException {

System.out.println("Pre routing...");
return false;
}

public boolean postRouting(CalloutMediatorMessage message,
CalloutMediatorMessage response,
Throwable e) throws MediatorCalloutException {
System.out.println("Start Post routing...");
return true;
}

public boolean preRoutingRule(CaseType caseType,
CalloutMediatorMessage externalMediatorMessage) throws MediatorCalloutException {
System.out.println("Start PreRoutingRule.");
HashMap payload = (HashMap)externalMediatorMessage.getPayload();
Element payloadNode = (Element)payload.get("request");

return true;
}

public boolean postRoutingRule(CaseType caseType,
CalloutMediatorMessage externalMediatorMessage,
CalloutMediatorMessage externalMediatorMessage1,
Throwable throwable) throws MediatorCalloutException {
System.out.println("Start PostRoutingRule.");

HashMap payload = (HashMap)externalMediatorMessage.getPayload();
Element payloadNode = (Element)payload.get("request");
return true;
}
}

Invoking Composite from JAVA/JSP

According to Bug 8561287, we have to add "binding.adf" manually into composite.xml in order to invoke the composite with JAVA/JSP. I've spent quite a long time to figure this out as it's not clearly documented in our doc.

there are 4 libs that should be in the classpath.

1. fabric-common.jar located at
$SOA_HOME\Oracle_SOA1\modules\oracle.fabriccommon_11.1.1
2. soa-infra-mgmt.jar located at
$SOA_HOME\Oracle_SOA1\modules\oracle.soa.mgmt_11.1.1
3. wsclient_extended.jar located at
$SOA_HOME\Oracle_SOA1\webservices
4. weblogic.jar or wlfullclient.jar

next step is changing the composite.xml to add binding.adf like below(bold) :

  <service name="receivePO" ui:wsdlLocation="receivePO.wsdl">

    <interface.wsdl interface="http://oracle.com/sca/soapservice/POProcessing/PoProcessing/receivePO#wsdl.interface(execute_ptt)"/>

    <binding.ws port="http://oracle.com/sca/soapservice/POProcessing/PoProcessing/receivePO#wsdl.endpoint(receivePO/execute_pt)"/>

  </service>

  <service name="receivePO_BPEL" ui:wsdlLocation="receivePO.wsdl">

    <interface.wsdl interface="http://oracle.com/sca/soapservice/POProcessing/PoProcessing/receivePO#wsdl.interface(execute_ptt)"/>

    <binding.adf serviceName="bpel_client" registryName=""/>

  </service>


and actual java code :

Locator locator = null;
try {
Hashtable jndiProps = new Hashtable();
jndiProps.put(Context.PROVIDER_URL,
"t3://localhost:8001/soa-infra");
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
jndiProps.put(Context.SECURITY_PRINCIPAL, "weblogic");
jndiProps.put(Context.SECURITY_CREDENTIALS, "welcome1");
// jndiProps.put("dedicated.connection", "true");

locator = LocatorFactory.createLocator(jndiProps);
Composite composite = locator
.lookupComposite("default/PoProcessing!1.0");
List svcList = composite.getServices();
for (Service obj : svcList) {
System.out.println(" > Name=" + obj.getName() + ", WSDL="
+ obj.getWSDLURL());

}

StringBuffer xml = new StringBuffer();

xml.append("<ns1:PurchaseOrder xmlns:ns1=\"http://xmlns.oracle.com/ns/order\">");

xml.append("<ns1:CustID>1111</ns1:CustID>");

xml.append("<ns1:ID>2222</ns1:ID>");

xml.append("<ns1:productName>iPod shuffle</ns1:productName>");

xml.append("<ns1:itemType>Electronics</ns1:itemType>");

xml.append("<ns1:price>98765</ns1:price>");

xml.append("<ns1:quantity>30</ns1:quantity>");

xml.append("<ns1:status>Initial</ns1:status>");

xml.append("<ns1:ccType>Mastercard</ns1:ccType>");

xml.append("<ns1:ccNumber>1234-1234-1234-1234</ns1:ccNumber>");

xml.append("</ns1:PurchaseOrder>");


NormalizedMessage input = new NormalizedMessageImpl();
String operationName = "execute";

Document doc = SOAUtil.getDocumentBuilder(true).parse(new StringInputStream(xml.toString()));
//input.getPayload().put("payload", doc.getDocumentElement());
input.getPayload().put("request", doc.getDocumentElement());

Service svc = composite.getService("receivePO_BPEL");
svc.post(operationName, input);
System.out.println("End");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (locator != null)
locator.close();
} catch (Exception e) {
}
}

this is it! good luck!

Wednesday Aug 27, 2008

gencon bug in IBM JDK earlier than SR5

be careful to use -Xgcpolicy:gencon when using JDK earlier than SR5.

there is a bug :

IZ23122: FAILURE TO FREE NURSERY RESULTS IN ENDLESS GC CYCLES

this can eventually lead the WAS to OOM as compaction doesn't take place
because of bad internal logic. u can witness that cpu usage top to 100% and do nothing just wasting whole cpu time to try gc.

use it carefully especially if u're using BPEL or ESB and handling large payload, though it's
not the the *best-fit* gcpolicy for them in most cases.

About

Solution & Technology Architect, Asia Pacific

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today