Pages

Friday, October 23, 2009

Inter-portlets communication in Oracle Webcenter 11g

Assuming there are two portlets on one page: portlet1 and portlet2. And when making some changes on the portlet1, the portlet2 will make changes as well according to the value changes happening in portlet1.

How to make communication between portlets?

There is a property in each portlet called partialTriggers, which means the current portlet is listening to the one, whose id is the value of this property.

Here is a sample:

<adfp:portlet value="#{bindings.ParameterFormPortlet1_1}" id="portlet5" />

<adfp:portlet value="#{bindings.OmniPortlet1_1}" id="portlet1" renderPortletInIFrame="true" partialTriggers="portlet5"/>

From the above example, we now know portlet1 is listening to portlet5. Once portlet5 has some changes happening, it will trigger the portlet1 to refresh as well.

Monday, September 28, 2009

Webcenter Interaction and HTTP Proxy

To make WebCenter Interaction work with the HTTP proxy, you need to make some changes to the configuration files located in <wci_home>/settings.

In configuration.xml, you need to locate SystemProperties and change ServerName and HTTPPort to match your proxy server.

error when installing UCM

When installing the UCM in WinXP, I choosed the language as Chinese and it threw an error with the error code as 1057, which looked like

Error 1057:

After choosing English as its language, it was installed successfully.

Framebusing in ADF

Last time, we did a poc on webcenter 11g. There was a requirement to develop a new function as ADF application, and then integrated it into Webcenter 11g as web page.

When integrating it, it threw the error like this:

Warning: Unable to load content in a frame. Frame content will load at the top level.

After checking , there is a framebusting configuration in web.xml. If you wanna consume your ADF apps in a frame, you have to set it as "never".

Here is an example:

<context-param>
<param-name>oracle.adf.view.rich.security.FRAME_BUSTING</param-name>
<param-value>never</param-value>
</context-param>

After adding the above configuration in web.xml in your apps, it will be consumed in any other frames successfully.

google map view

http://code.google.com/apis/maps/documentation/examples/geocoding-simple.html

The above example from google website for your reference.

Most time we need the below APIs to get the latitude and longitude of a given address:

geocoder.getLatLng(address, ...)

JDeveloper 11g default weblogic user's password

When JDeveloper 11g is installed, once you test your application in default server engine in JDev, JDeveloper will create a new domain "Default Domian" and use the default weblogic server to test the applications developed.

The defaut administrator (weblogic) password for Weblogic Server is "weblogic1".

BTW, the default user and password is located in the boot.properties file under this folder: ../Application Data/JDeveloper/system11.1.1.1.33.53.92/DefaultDomain/servers/DefaultServer/security.

Monday, August 31, 2009

sounds path of Viewlet builder

Today i recorded sounds with slides in viewlet builder. After almost done, i found missing something in the first slide, which contains the audio as well.

Then i create a new slide with the modification inside. but i didn't wanna speak it again. So i tried to find out the one recorded in the original first slide and use that directly on my new slide.

After searching, the sounds were recorded with mp3 format and stored in the directory:

C:\Documents and Settings\<user>\Local Settings\Temp\qarbon\ViewletBuilder6 Professional_6191\documents\<viewlet_name>_qvp

Friday, August 28, 2009

Clear the cached data of popup component in ADF Faces

I'v developed a project in JDevelop 11g recently.

In this project, i popped up a dialog to upload the document into Oracle UCM with self-defined metadata set on the check in form.

Each time after i check in content once in that popup dialog, i reopened it up and found the previous input were still kept there.

How to solve this problem? After going through all the properties of popup component, i found there is a property called contentDelivery, which its default value is lazy.

Here are the explanation of values of this property :
  • lazy -- the default strategy described above. The content isn't loaded until you show the popup once, but then is cached.
  • immediate -- load the content onto the page immediately, so it displays as rapidly as possible. Use this for popups that are certain to be used by all users every time they use this page.
  • lazyUncached -- the content isn't loaded until you show the popup, and then is re-fetched every subsequent time you show the popup. Use this strategy if the popup shows data that can become stale.
After setting its value as lazyUncached, my problem was fixed.

For example:

<af:popup id="noteWindow" contentdelivery="lazyUncached">
...
</af:popup>


For more info, please refer to the following document:

http://www.oracle.com/technology/products/adf/adffaces/11/doc/adf-richclient-api/tagdoc/af_popup.html

Tuesday, July 7, 2009

Pass parameters to the timer in C#

These days I am using C# to develop the timer component running as a windows service, which runs automatically in a specific interval.

In C#, there are 3 kinds of timer type definitions:

1. System.Windows.Forms.Timer
2. System.Threading.Timer
3. System.Timers.Timer

In my project, I choose to use the third one: System.Timers.Timer

Here is the sample usage of this kind of timer:

System.Timers.Timer timer = new System.Timers.Timer();
timer. Interval = 10000; // set the interval as 10000 ms
timer.Elapsed += new System.Timers.ElapsedEventHandler(this.timer_Elapsed); // set the event to execute
timer.AutoReset = true; // false: only execute once
timer.Enabled = true; // to decide if execute the event of timer specified


public void timer_Elapsed(object sender, EventArgs e)
{

}

From the above sample, we know it is quite easy to use it.

Next, I have a problem if I need pass some parameters to be used in the timer event defined above: timer_Elapsed(…). The two input parameters of this event interface are fixed, you can’t add more in.

There is a tricky to achieve it. Since we can’t add more input parameters in this event, we can set the parameters into the unused property of that sender object. This way is simple, but not good.

After researching, i find a better way to deal with it: creating a new timer to extend the system timer , and then defining the additional parameters inside this new timer.

Here are the sample codes:

// define a class to extend the timer,
// then define those additional parameters to be used in the event.
// for example: add one more parameter: param1.
namespace XXX
{
public class TaskTimer : Timer
{
private string param1;

public string Param1
{
get
{
return param1;
}
set
{
param1= value;
}
}

public TaskTimer() : base()
{
}
}
}

// usage of this timer
using XXX;

TaskTimer timer = new TaskTimer();
timer.Interval = 10000;



// the event definition
public void timer_Elapsed(object sender, EventArgs e)
{
String param1 = (TaskTimer) sender).Param1;

}

Thursday, June 11, 2009

RIDC - New Connector to Oracle UCM

As required sometime, you might need to access and interact with Oracle UCM externally.

Originally, Oracle UCM exposes two kinds of interfaces to be used:

1. SOAP Web Service

2. Content Integration Suite (CIS)

Remote Intradoc Client (RIDC) is new in latest release.

In contrast with both CIS and SOAP, the RIDC connector is very lightweight and simple to use. There's no WSDL or J2EE bloat at all; RIDC is just a "Plain Old Java Object" wrapper around UCM web services... so it's very easy to embed in a Java application.

To get started, download the most recent version of the Content Integration Suite from Oracle. This ZIP file contains two folders: one for the new RIDC connector, and one for the standard CIS connector. I'd suggest you take a look at the "ridc-developer-guide.pdf" before you go any further. The samples and JavaDocs are also very useful, but you can peruse them later.

Basically, it's a very simple API in which you create and open a connection with UCM, build up a dataset, and call a service. The data is then returned to you that you can map to java objects to act upon.

The hardest part is to figure out what services in UCM to call and what parameters to pass. You'd better to bookmark our Services Reference Guide for those information.

Before using it, copy the RIDC library "oracle-ridc-client-10g.jar" to the java project.

Here are some sample snippets:

(1) Create and Open a connection to UCM

//arguments needs to connect to UCM
String idcConnectionURL = "idc://localhost:4444";
String username = "sysadmin";
String password = "idc";

//Create the IdcClient
IdcClientManager clientManager = new IdcClientManager ();
IdcClient client = clientManager.createClient (idcConnectionURL);
IdcContext userContext = new IdcContext(username, password);

(2) Ping Server

//Create the DataBinder and populated it with needed information for
//the service call
DataBinder dataBinder = client.createBinder ();
dataBinder.putLocal ("IdcService", "PING_SERVER");

//Join the binder and the user context and perform the service call
ServiceResponse response = client.sendRequest (userContext, dataBinder);

//Convert the response to a dataBinder
DataBinder responseData = response.getResponseAsBinder ();

//Display the status of the service call
System.out.println (String.format("Ping Server response: %s", responseData.getLocal ("StatusMessage")));

UCM and WCI integration

Lots of customers are interested in the integration between UCM and WCI.

There are several ways to achieve it:

1. Deploying CPS portlets provided by UCM: you have to install the CIS before deploying those portlets

2. Gateway the UCM pages in WCI: there are always some problems especially on javascript, which disables some functions of it.

3. Embed the UCM pages in WCI through iframe

4. Developing the custom portlets for those UCM functions like check in, search etc.

Thursday, June 4, 2009

Unreadable data through Oracle SAP Adapter

When connecting to SAP through Oracle SAP Adapter in Oracle BPEL, the data of Chinese characters inserted into SAP from BPEL is unreadable. But those data in BPEL is correct.

After checking the whole environment, we noticed that the JVM of OC4J Container running SAP Adapter doesn't contain the encoding parameter.

Here we made the below changes on OC4J JVM settings:

-Dfile.encoding=UTF-8

Then it worked properly.

Thursday, February 5, 2009

如何测试和调试Apache服务器

Apache是运行在Linux操作系统上的头号Web服务器。很多小地方都可以用来调整Apache的性能,并降低它对系统资源的影响。其中一个就是调整内存使用率,当然达到这一目的可能还是需要花点功夫的。

例如,通过ps来确定httpd线程的内存使用率,可以输入下面的命令:

# ps -U apache -u apache u
USERPID %CPU %MEMVSZRSS TTYSTAT START TIME COMMAND
apache130670.05.3 149704 54504 ?SOct071:53 /usr/sbin/httpd -f /etc/httpd/conf/httpd.conf -DAPACHE2
...

上面这段输出显示了单个httpd进程使用了50 MB的RSS(驻留集大小)内存(或者非交换物理内存),以及149 MB的VSZ(虚拟)内存。这当然在很大程度上取决于你在Apache里加载和运行的模块数量。这决不是一个固定的数字。由于这个数字里还包含了共享库包,所以不是100%的准确。我们可以认为RSS数字的一半是httpd线程真正使用的内存数,这可能还有点保守,但是离我们的目的已经非常接近了。

在本文里,我们假设每个httpd进程都在使用了27 MB内存。然后,你需要确定可以让httpd真正使用的内存数。根据运行在机器上的其他进程,你可能希望要求50%的物理内存都供Apache使用。在一个装有1GB内存的系统上,就有512MB的内存可以被划分为多个27MB的内存,也就是大约19个并发的httpd内存。有些人坚持认为每个httpd 线程“真正”使用大约5MB的内存,所以从理论上讲你可以把512MB的内存划分出102个并发进程供Apache使用(要记住的是,除非你的网站需要极其巨大的流量,否则这种情况是非常罕见的)。

在默认状态下,Apache会分配最大256个并发客户端连接,或者256个进程(每一个都对应一个请求)。按照这种设置,一个流量巨大的网站会在顷刻间崩溃(即使你假设每个进程占用5MB内存,那也需要1.3GB的内存来满足请求的数量)。如果不采取其它措施,系统会通过硬盘来尝试使用交换空间以处理它无法在物理内存中完成的任务。

其他可以调整的项目包括KeepAlive、KeepAliveTimeout和MaxKeepAliveRequests等设置。可以放在httpd.conf文件里的推荐设置有:

ServerLimit 128
MaxClients 128
KeepAlive On
KeepAliveTimeout 2
MaxKeepAliveRequests 100

通过将KeepAliveTimeout从15秒减到2秒,可以增加MaxClients命令;19太小,而128要好得多。通过减少进程存活的秒数,你可以在相同的时间内允许更多的连接。

当然,如果没有真正的测试在背后支持,数字就是毫无意义的,这就是ab的作用之所在。使用ab对Apache配置文件(MaxClients等于 256、ServerLimit等于256、KeepAliveTimeout等于15)进行调整,使其能够满足1000个请求(100个连续请求并发产生)的调整方法如下。(在执行测试的时候要确保服务器上有一个终端打开以观察系统的负载。)

$ ab -n 1000 -c 100 -k http://yoursite.com/index.php

现在把上面的服务器设置改为更加保守的设置,重新启动Apache,试着再次测试(总是从远程计算机上进行,而不是本机)。

在这里的测试中,不同的设置导致执行所消耗的时间产生了一倍的差距(分别为27.8s和16.8s),但是负载的平均值为0.03和0.30。这可能会使得你的网站变得稍慢,但是会确保它不会在高负载的情况下崩溃。还要记住的是,你将需要进行多次测试,以便取得一个平均值。

使用ab是测试调整Apache配置的一个极佳方法,应该在你每次做出影响性能的更改时使用它。

apache web server 内存暴增解决办法

0 K" ]. ^: n4 o0 R/ o1 w前阵子总是发现 httpd 进程的使用内存总量居然达到了上百Mb,有时甚至上Gb,真是夸张。通过排查,发现是 Apache 中开启了持续长连接导致。, t* Z$ ^) a& ?/ I/ u! w9 b

9 S9 {3 y$ f9 ^# s, pApache 进程的内存使用是 "递增/渐进" 式的,也就是在当前进程的 httpd 过程中,内存使用是持续增加的,也就是说在该进程退出之前,内存是持续增加的。主要是由于下面三个参数来控制。3 u \6 O5 [" @
s2 z. ~/ U" Q# J4 S& Y. v" b
KeepAlive On 设定是否要开启持续长连接,因此在这里把它打开2 Y' N7 m; m+ V/ Q

$ m- @( i' O: _! L9 @8 HMaxKeepAliveRequests 50 在一次持续长连接中,最多允许接收几次请求,如果设置太大的话,很可能导致 httpd7 m3 y: _! M7 ~6 @, C, N2 }' N
进程持续消耗很多内存,因此可以选择一个适当的值,因为重新创建一个新的进程也是要有一定开销的5 m" | B; ]% [

( c$ J' [5 G8 V8 C7 Q; i' b3 j9 sKeepAliveTimeout 5 设定一个长连接在没有活动后等待多久自动关闭,可以设置小一点,不过跟上面的类似,如果太小的话,也会导致频繁创建新的进程1 [7 ?2 C2 e- [2 @

5 l, q& _2 P4 i# @4 _9 X3 O现在,调整完上面的参数后,会发现 httpd 进程不再象以前那样狂吃内存了。