Thursday, November 4, 2010

Struts2 Analysis

Recently i got the chance to work on struts2. Briefly, its a J2EE MVC web framework like struts-1, JSF, ADF etc. During development, I found following its pros and cons:-

1. Excellent support for Spring, Freemarker, Tiles, AJAX, JQuery etc.
2. Very easy to understand as compared to Struts-1, JSF & ADF
3. Highly configurable & extendable framework
4. Builtin support for token generation,Internationalization etc
5. Good abstraction away from Servlet/JSP
6. Struts2 tags are simpler to use
7. Good builtin Validation framework
8. New version of MyEclipse 8.6 has builtin support for Struts2
9. Good management of properties files like global level, package level and action level

1. Poor documentation.
2. Struts2 themes make the framework harder to understand and slower. In order to develop or update themes, someone must know Freemarker language.
3. Immature internationalization support.Tags not fully support of localization.
4. Interceptors are not flexbile enough as compared to Filter. As you can not define interceptor in web.xml alongwith parameters.
5. No builtin pagination and data grid support.
6. Problem in localization for display tag

Monday, June 7, 2010

End-to-end Weblogic Clustering steps with Apache Proxy Plug-in

End-to-end Weblogic Clustering steps with Apache Proxy Plug-in


This tutorial will give you quick overview about how to create a new cluster using tow physical boxes and how to configure Apache Proxy Plug-in as a load balancer. It is assumed that person must have good knowledge of J2EE & Weblogic Server.


This tutorial covers the following topics:

1.      Overview

2.      System Requirements

3.      Creating a Cluster

4.      Monitoring the Cluster

5.      Load Balancing using Apache Web server & Proxy plug-in

6.      Create a clustered-enabled web-application for Weblogic Server

7.      Deployment on Clustered

8.      Best Practices

9.      Related Information


A WebLogic Server cluster consists of multiple WebLogic Server instances, running simultaneously and working together to provide increased scalability and reliability. A domain includes one or more WebLogic Server instances, which can be clustered, nonclustered, or a combination of clustered and nonclustered instances. A domain can include multiple clusters.

A cluster appears to clients as one WebLogic Server instance. The server instances that constitute a cluster can run on one machine or on different machines. You can increase a cluster’s capacity by adding server instances to the cluster on an existing machine, or by adding machines to the cluster to host the incremental server instances.

All server instances in a cluster use multicast or unicast to broadcast regular server heartbeat messages to other members of the cluster. Each heartbeat message contains data that uniquely identifies the server that sends the message. Servers broadcast their heartbeat messages at regular intervals. In turn, each server in a cluster monitors the multicast or unicast address to ensure that all peer servers’ heartbeat messages are being sent.

System Requirements

Make sure that your system environment meets the following requirements:

Software Requirements
  • Ms. Windows 20003
  • Oracle Weblogic Server 10.3
  • Apache Web Server 2.2

Minimum Hardware Requirements

Item Specification
Processor Type Intel Xeon
Processor Speed 2.4 GHz or higher
Number of Processor 1 or more (if required)
Memory 4 GB
Free Hard Disk Space 20 GB
Operating System MS. Windows 2003

Creating a Cluster

Perform the following steps:

1.      Install Weblogic Server in Box-A and Box-B in the same directory structure.

Box-A   Suppose IP Address is :
Box-B   Suppose IP Address is :

2.      Create a Domain (myDomain)  in Box-A then Start the AdminServer (suppose port is 7001 for Admin) of that newly created Domain

3.      Open Admin Console

4.       Create two Managed Servers MS3 and MS4 with following configurations.

MS3 Listen Port: 7003
MS3 Listen Address:

MS4 Listen Port: 7003
MS4 Listen Address:

5.      Create two machines (M1 and M2) with following node manager configuration and add MS3 to M1 and MS4 to M2.

Nodemanager Listen Address:
Nodemanager ListenPort: 5556

Nodemanager Listen Address:
Nodemanager ListenPort: 5556

6.       Now start NodeManager in Box-A and see in the admin console that its accessible from M1.

Home –>Summary of Machines –>Machine-A –>Monitoring
Make sure that the Nodemanager Status is “Reachable”.

Steps For Box-B (Second Managed Server Box)

7.      Paste the Domain from Box-A to Box-B in the Same Location where it is available in Box-A.

8.      Open the command prompt and set environment variables using setWLS.cmd.

9.      Enroll NodeManager of Box-A with myDomain created in Box-B  using following WLST command:-


10.            Start the NodeManager at Box-B and login to AdminConsole of Box-A and then check that the Machine-2 Nodemanager is showing “reachable”.

11.  Create a Cluster with following information:-

Field Value
Name myCluster
Messaging Mode Unicast
Clustered Address,

12.  Click myCluster. Click the Configuration > Servers tab.

Add MS3 and MS4 servers in myCluster and click Finish.

13.  Start the MS3 using following shell command:-

myDomain\bin>startManagedWebLogic.cmd MS3 from Box-A

14.  Watch the server start up using the shell's standard output stream.  At some point, you should see it begin listening for cluster communication and begin waiting to synchronize with other servers in the cluster. Because the other servers have not started, there is nothing for it to synchronize with yet:

<Jun 3, 2010 5:41:36 AM CDT> <Notice> <Cluster> <BEA-000197> <Listening for announcements from cluster using unicast cluster messaging>

<Jun 3, 2010 5:41:36 AM CDT> <Notice> <Cluster> <BEA-000133> <Waiting to synchronize with other running members of Cluster_1.>

<Jun 3, 2010 5:42:06 AM CDT> <Notice> <Cluster> <BEA-000162> <Starting "async" replication service with remote cluster address "null">

15.  Repeat the previous steps to start the other managed servers from the Box-B. Once again, use the shell's standard output stream or the server log to confirm that the servers joined the cluster successfully:

myDomain\bin>startManagedWebLogic.cmd MS4

<Jun 3, 2010 6:03:07 AM CDT> <Notice> <Cluster> <BEA-000197> <Listening for announcements from cluster using unicast cluster messaging>

<Jun 3, 2010 6:03:07 AM CDT> <Notice> <Cluster> <BEA-000133> <Waiting to synchronize with other running members of Cluster_1.>

<Jun 3, 2010 6:03:16 AM CDT> <Notice> <Cluster> <BEA-000142> <Trying to download cluster JNDI tree from server MS4.>

<Jun 3, 2010 6:03:16 AM CDT> <Notice> <Cluster> <BEA-000164> <Synchronized cluster JNDI tree from server MS3.>

Above information is showing that cluster has been created successfully.

Monitoring the Cluster

1.      Return to the administration console. Select Environment > Clusters from the Domain Structure panel. Then select your cluster.

2.      Click the Monitoring tab. You can see summary, health and Failover tabs. The Cluster—>Monitoring page displays how many Managed Servers are configured for the current cluster, and how many of the configured Managed Servers are currently running. For each Managed Server configured for the cluster, the monitoring table displays the current state of the server instance, and metrics about activity since the server instance was started.

Load Balancing using Apache Web server & Proxy plug-in

The Apache HTTP Server Plug-In allows requests to be proxied from an Apache HTTP Server to WebLogic Server. The plug-in will also serve as a load balancer for Weblogic Server.

Note: You can install apache server on Weblogic machine or separate machine. Assume Apache Web Server is running at

The Apache plug-in is distributed as a shared object (.so) for windows.

1.    Copy the (for Apache 2.2) from <Bea-Home>\server\plugin\win\32 to <Apache-Home>\modules\

2.    Add following lines in the httpd.config file for single clustered:-

LoadModule weblogic_module modules/

<IfModule mod_weblogic.c>


Debug                    ON

WLLogFile             c:/tmp/global_proxy.log

WLTempDir             "c:/myTemp"

DebugConfigInfo       On

KeepAliveEnabled       ON

KeepAliveSecs         15

DynamicServerList     ON


<Location /weblogic>

SetHandler weblogic-handler

Path-trim weblogic


Note:-  Apache plug-in will treat as primary server. It mean first request will go to MS3 managed server.

3.    Restart Apache Server.

4.      Deploy the application on a cluster. For example your application context path is sessionDemo.

5.      Now, access the application using Apache Server like

Where is the IP address and port of Apache Web Server.

6.     To verify the configuration of the proxy server & status of Weblogic Managed Server:-

Clustering Best Practices

  1. When creating the clustered WebLogic Server instances on a single machine, specify an unused localhost port such as for the Listen Address. If you leave the Listen Address field blank, the server binds to all available IP addresses on the machine. If you specify "localhost" as the Listen Address, the server binds to all localhost addresses (127.0.0.x).
  2. When creating a new cluster, it is recommended that you use unicast for messaging within a cluster. For backward compatibility with previous versions, WebLogic Server you must use multicast for communications between clusters.
  3. Always specify an unused Multicast address and port number for production clusters. This ensures that only the cluster's messages are broadcast on the address/port combination.

4.      Do not install WebLogic Server on machines that have dynamically assigned IP addresses.

Related Information

  • Weblogic Clustering
  • Weblogic Clustering
  • Cluster unicast messaging mode
  • J2EE Clustering
  • Installing and Configuring the Apache HTTP Server Plug-In

Thursday, January 28, 2010

Quick Oracle Database 10G Patch Installation on Windows 2003 innon-clustered environment

This installation procedure will apply from any version of Oracle DB 10G to upgraded version of 10G in non-clustered or non-RAC environment.

1. Before installing, shutdown all database services from the control panel.

2. Run the db_patch/setup.exe file.

3. During installation, specify existing installed database home.

4. Select default in rest of the steps of the installation and complete the installation.

5. Start the listener and database services from the control panel. dbconsole service remain stop.

6. Run the Oracle Database Upgrade Assistant from Start --> Program Files --> Oracle_DB_10G_Home-->Configuration and Management Tools.

a. select the name of the Oracle Database that you want to update

b. On the Recompile invalid objects screen, select the Recompile the invalid objects at the end of upgrade option

c. If you have not taken the back up of the database earlier, on the Backup screen, select the I would like to take this tool to backup the database option. [Optional]

This patch installation will take almost 1 hour depends upon the processor.

For detailed instructions and troubleshooting, pls see