Sunday

Setting up Web logic clusters for GWT applications

Inspired by the following post WebLogic Load Balancing for Oracle ADF Applications i have decided to make some agile test for GWT applications.
First we will develop a simple hello world GWT application and configure load balancing cluster. Sample GWT application will be deployed on WebLogic cluster, Load Balancing domain or proxy domain will distribute user requests between cluster members.
1) Develop sample GWT application
It's a hello world web application with one text field and button on a web page. I use maven to develop the application. We can choose any web application to deploy on web logic cluster, any way our aim is to configure web logic cluster and we will go though all over the steps next.
2) Configure cluster domain
It's very easy to setup and configure cluster on web logic. Just start Configuration wizard and select customize installation.

Change port number of the Admin server, in my case it is 7002

On Configure Managed server page add two new managed server and change the port to 7003 and 7004.

Configure cluster by default and we will change the multicast to unicast.

On the next page assign all the managed servers to the cluster.

On the configure machine page add one physical machine and address the listen address to localhost as follows:

On next page apply cluster with manged serves to physical machine:

And finally provide domain name and the location of the domain. In my case i have provide the domain name as cluster_domain.
At this moment cluster is installed and ready to use. Start the cluster domain from program menu, and open the console by following url:
http://localhost:7002/console
Start node manager from the start menu to manage managed servers, go to the console home page->cluster->control and select all the managed servers and click to start. After a few moments states of the servers should be running mode.

Now, it's time to deploy our GWT web application on cluster. Deploy the web application on cluster by web inteface as follows:

3) Set Up the HttpClusterServlet:
Here we will describe how to develop and configure proxy plugin for load balancing. We will use a web logic domain as a proxy plugin and configure HttpClusterServlet on it. To use http cluster servlet, configure it as a default web application on proxy domain. The default web application will only contain a web.xml and weblogic.xml file on WEB-INF directory and nothing more. See the link to more about HttpClusterServlet.
I have used sample web.xml and weblogic.xml available in documentation, just changed WebLogicCluster parameter value to:

localhost:7003|localhost:7004

and build an web application with war archive, name the archive as loadBalancer.war
At this moment we will create another weblogic domain with standard configuration and name the domain as proxy_domain. Deploy the loadBalancer.war on the proxy domain as follows:

4) Test the configuration.
For now we have configured everything to test our web application running on cluster. Address you web applications home page on any browser, in my case it is as follows:
http://localhost:7001/app-name/context-root/HelloGwt.html
One of Managed Servers from Cluster environment will response. Go to the following location to check the output log from the server
\user_projects\domains\cluster_domain\servers\ManagedServer_1\logs\ManagedServer_1.out
In my case server 1 response in this time, if i have opened second session, by pointing to the same 7001 port and it was handled by seconed Managed Server and so on. It was because cluster server was configured with round-robin algorithm.
The above configuration will consider for any web application not just fro GWT application. There are a lot of configuration left behind on httpServlet plugins.
For more information please see following resource:
Load Balancing with a Proxy Plug-in

Tuesday

Implementing DataServices with Oracle data service integrator

DataService: one kind of special service, which expose interface for data stored in sources such as relational databases, CSV files & MS-Excel files. DataServices plays a vital role on IT strategy like SOA. Any organization have to have expose their master data to any enterprise application. Through data services a company enables to have high-quality, consistent data at the right place at the right time.
In practical, data services exposes data, represented as Entity Data Model (EDM) objects, via web services accessed over HTTP. The data can be addressed using a REST-like URI. The Astoria service, when accessed via the HTTP GET method with such a URI, will return the data. The web service can be configured to return the data in either plain XML, JSON or RDF+XML. For more information see the following article about data services.
It's not hard to create and maintain data service on standard way, a lot of ORM framework like hibernate, iBatis, toplink even low level jdbc framework is good enough to built data services. Sometimes it's hard to maintain and governece this type of enterprise application, because life cycle of the development process is vital. For these reason, in this post i will give some overview of tools and frameworks to accelerates application development and deployment by simplifying the complex task of building and maintaining access to and from multiple external data sources.
1) XAware Open Source Data Integration: It provides real-time, bi-directional data integration with a service-oriented flavor. XAware makes other tools and frameworks more productive by hiding data access complexity behind "XML views". XML views span any number of data sources, and can read data, write data, or transfer data between sets of sources, all within a distributed transaction.
2) WSO2 Data Services: With WSO2 Data Services, data can be exposed and accessed in a secure (using WS-Security) and reliable (using WS-ReliableMessaging) manner; data is also made available for mashing-up with other Web services.
3) Native Oracle XML DB Web Services: Oracle 11g Database makes the conversion of existing PL/SQL code into web services easier than ever by providing Native XML DB web services. With some simple configuration, this functionality exposes PL/SQL code code as web services.
4) Oracle Data Service Integrator:It brings a service-oriented architecture (SOA) approach to data access. Data Services Integrator enables organizations to consolidate, integrate, and transform as needed disparate data sources scattered throughout their enterprise, making enterprise data available as an easy-to-access, reusable commodity: a data service.
Next we will implement a simple data service project to see how it's easy to develop on oracle data service integrator.
For study purpose i decided to make the sample project as simple as possible. First we will create a table on Oracle data base and expose this table as a web service through oracle data service integrator. In conclusion you will get more resources links to follows.
Following platforms will get on work:
1) Oracle 10g data base.
2) Oracle data service integrator 10g r3
Download and install products on your local machine. I am going to use user scott to sample purpose.
1) Create a table on user scott as follows:
CREATE TABLE document ( doc_id VARCHAR2(200), doc_type_i VARCHAR2(200), vid_doc VARCHAR2(200), "COMMENT" VARCHAR2(200), num_doc VARCHAR2(200), dat_doc DATE );
Insert some data on it.
2) After installation of data service integrator create one domain, name the domain base_domain.
3) Open the eclipse workshop of oracle data service integrator and create a new server based on domain base_domain.
4) Open admin console, the link should be as follows:
http://localhost:7001/console/console.portal?_nfpb=true&_pageLabel=HomePage1
5) Add a non XA data source on it. Provide all the necessary information as follows:
database name: scott
jndiName:nsiDataSource
hostname:mercury
database username:scott
password:tiger
now we are ready to create data service on workshop.
6) Open the workshop and change the perspective to Oracle data service integrator.
7) Create a dataspace project.
8) Create one physical data service as follows:
Data Source type: Reletional
DataSource: nsiDataSource
DataBase type: Oracle->9->Oracle 9.x and above
Relational data base object: Tables and views
and click next
9) On SQL select source views, select schema Scott and expand it, also select table named "Document".

10) On operation page select check box public and click next button.
11) Put the data service name as getNsiDocument and click finish.
This will create file getNsiDocument.ds and open a overview window as follows:

12) On the above page go to the tab TEST and select operation getNsiDocument and click run. This will show you some result.
13) Now we will create logical data service over physical service. Click new-> New logical service.
DataService Name: getNsiDocument_l
Select logical data service type: Entity data service
and click finish. This will create a new logical service named getNsiDocument_l and now the project has error, don't worry we will make up it very soon.
14) Right click on the overview tab and select add operation. Select it as a public service as a kind of read and name the service as getNsiDocumentL.
15) Click on the tab Query Map. Expand the node getNsiDocument.ds and drag getNsiDocument() to the Query map.
16) Select the getNsiDocument*, press crtl and drag the element over Return box.

17) Right click on the return box and select save and Associate xml type.
18) just change the namespace as ld:Physical/getNsiDocumentL and click ok.
19) For now the project should be valid and we can test the logical data service.
Click tab TEST and click the button run.
20) Now we will add a where clause on our logical service. Click query Map, select getNsiDocument() box and the condition editor will highlighted. Click on add where clause, select element vid_doc and add ="14" in my cause. See the following illustration.

21) Save all the work and test again - now the result should be filtered by where clause.
Here we have done most of the work. Now we will create a web service witch will wrap the logical service.
22) Create new web service map, name nsiDocumantWs and drag the logical service named getNsiDocumentL over the web service map.
Just now we have finished all our work. We have create physical data service and a logical data service over it, at last create a web service map for the logical service.
Now we can test our data service, for these copy the following url and open it on any web browser:
http://localhost.fors.ru:7001/wls_utc/begin.do?
Right click on the nsiDocumentWs.ws and click copy wsdl url. Paste the url on weblogic test client and click on getNsiDocumentL button. You should see some result on page as follows:

In conclusion, we able to understand how easy it is to create data service in oracle data service workshop on declarative way. For more information see following pages:
1) Tutorial.
2) Generate web service from data services.
On the next post i will demonstrate a simple example to use DSP protocol on OSB 10gR3.

Saturday

Solving xcb_xlib.c:50: xcb_xlib_unlock: Assertion 'c->xlib.lock' failed. on fedora 8

Yesterday i decided to upgrade osb 3.0 to OSB 10gr3 on my linux box. During installation i have first locate the famous error "xcb_xlib.c:50: xcb_xlib_unlock: Assertion 'c->xlib.lock' failed.". Through google, i have found a few solution to solve the problem but all the solutions gone in vain.
I have had following configuration:
[recon@localhost home]$ cat /etc/redhat-release
Fedora release 8 (Werewolf)
[recon@localhost home]$ java -version
java version "1.5.0_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_14-b03, mixed mode)
[recon@localhost home]$ rpm -q libxcb libX11
libxcb-1.0-3.fc8
libX11-1.1.3-4.fc8
First of all, i have tried to patch the library libmawt.so by sed -i 's/XINERAMA/FAKEEXTN/g' of my current JVM, but it was not help me to run the installer to install OSB 10gR3. Even i installed latest 1.6 JDK and patch the libmawt.so but in vain.
From one of linux forum, i found a suggestion to upgrade libxcb file and try again. Here is my all the step to resolve the problem:
1) upgrade yum install (nothing updated)
2) update libxcb
[recon@localhost home]$ sudo yum update libxcv
[recon@localhost tmp]$ rpm -q libxcb
libxcb-1.1-1.1.fc8
which will upgrade my libxcb to version 1.1
3) patch the libmawt.so for current JVM (it was unnecessary, because i have done it before)
4) run installer and all goes well.
For more information, you can visit the following post on oracle forum.