Running Oracle ADF application on High availability (HA) architecture

Oracle ADF is used to build large enterprise application. And if you want to have your application to run on high availabilty then you should understand what is High Availability (HA) .

What is High Availability –
High availability refers to the ability of users to access a system without loss of service. Deploying a high availability system minimizes the time when the system is down, or unavailable and maximizes the time when it is running, or available. This section provides an overview of high availability from a problem-solution perspective. With HA , even for new deployment you will never have down time.

Normally in large enterprise application , you don’t want your system to be down..Application deployed in cluster environment. If one of the server down then the user session should replicate to another cluster . Now , we have Oracle HTTP Server (OHS) or Apache plugin is to used to get single URL and manage internally to replicate the session and send request if one of cluster is fail.

How a web server handle request

webserver

Cluster- Group of managed server running to provide scalability and reliability. In this multiple wls instance simultaneously and working together.Cluster is part of WLS domain . A domain can have multiple cluster

Cluster


Architecture of Weblogic HA

apache web server

Now the important point for developer – Few points designing and developing Oracle ADF application for HA.
There are 6 types of memory scopes. Read more on ADF memory scopes

When the Fusion web application runs in a clustered environment, a portion of the application’s state is serialized and copied to another server or a data store at the end of each request so that the state is available to other servers in the cluster.If it not serialized then user will lose data upon fail-over.

WebLogic duplicates those sessions by serializing the objects in the session and than transfers it to the secondary machine. Only the object that are stored in the session will be replicated. From an ADF perspective this means that managed bean with pageFlowScope and above will be replicated.It is very well defined in Oracle documentation and A-team article.

Configuring Oracle ADF development for High Availability

=> Changes in Application server-

While doing development Jdeveloper integrated server will not throw any errors by default. Add this parameter in server has to be run with the following JVM parameter:

-Dorg.apache.myfaces.trinidad.CHECK_STATE_SERIALIZATION=all
 

Note that this check is disabled by default to reduce runtime overhead. Do not use this after your testing is complete.

-> Changes in ADF code

-> Please make sure that managed beans used in ADF application with a scope greater than one request should be serializable ( implement the java.io.Serializable interface). Specifically, beans stored in session scope, page flow scope, and view scope need to be serializable.

– All pageflowscope and viewscope managed beans should not contain UI bindings. In essence, component bindings should live for a http request (request scope or backingBean scope). Any state or data you need for a longer duration can be saved in a pageflowscope bean separately.

– Make sure Oracle ADF is aware of changes to managed beans stored in ADF scopes (view scope and page flow scope) and enable the tracking of changes to ADF memory scopes.

use below code to notify ADF

controllerContext ctx = ControllerContext.getInstance();
ctx.markScopeDirty(viewScope);

 


-> Configuring Application Modules

– Right-click the application module and select Configurations.Click Edit.Click the Pooling and Scalability tab.
Select the Failover Transaction State Upon Managed Release checkbox.

<AppModuleConfig ...
 <AM-Pooling jbo.dofailover="true"/>
</AppModuleConfig>
 

-> Configuring weblogic.xml

In weblogic.xml file, add entry as below persistent-store-type definition to the session-descriptor element like below

<weblogic-web-app>
    <session-descriptor>
    <persistent-store-type>
    replicated_if_clustered
    </persistent-store-type>
    </session-descriptor>
</weblogic-web-app>

 

-> Configuring adf-config.xml

In adf-config.xml file, add entry as like below

<adf-controller-config xmlns="http://xmlns.oracle.com/adf/controller/config">
 <adf-scope-ha-support>true</adf-scope-ha-support>
</adf-controller-config>

 

Happy Learning with Vinay In techartifact.

Ref- http://docs.oracle.com/cd/E12839_01/core.1111/e10106/adf.htm

Silent Installation of Weblogic and Webcenter portal

Requirment – Silent Installation of Weblogic and Webcenter portal

Implementation-

Silent-Mode Installation – Silent-mode installation is a way of setting installation configurations only once and then using those configurations to duplicate the installation on many machines. During installation in silent mode, the installation program reads the settings for your configuration from an XML file that you create prior to beginning the installation. The installation program does not display any configuration options during the installation process. Silent-mode installation works on both Windows and UNIX systems.
With previous releases of WebLogic Platform, you have the option of running the Configuration Wizard as part of the silent installation process. In WebLogic Platform 8.1, the Configuration Wizard cannot be run, automatically, with the WebLogic Platform installation program; it must be run separately. However, you can create a simple shell script or command file that sequentially runs silent mode installation and silent mode configuration. For more information about running the Configuration Wizard in silent mode, see Creating WebLogic Configurations Using the Configuration Wizard at http://download.oracle.com/docs/cd/E13196_01/platform/docs81/confgwiz/index.html.

-> Install the Weblogic

-> Download the WebLogic Installer … and put it in some directory
-> Create a silent.xml file that defines the configuration settings normally entered by a user during an interactive installation process, such as graphical-mode or console-mode installation. Here is the silent-wls10.3.6.xml file, see below

<?xml version="1.0" encoding="UTF-8"?>
   <bea-installer> 
     <input-fields>
       <data-value name="BEAHOME" value="\Oracle\Middleware_Home" />
       <data-value name="WLS_INSTALL_DIR" value="\Oracle\Middleware_Home\wlserver_10.3" />
       <data-value name="COMPONENT_PATHS"
        value="WebLogic Server/Core Application Server|WebLogic Server
/Administration Console|WebLogic Server/Configuration Wizard and Upgrade 
Framework|WebLogic Server/Web 2.0 HTTP Pub-Sub Server|WebLogic Server/WebLogic 
JDBC Drivers|WebLogic Server/Third Party JDBC Drivers|WebLogic Server
/WebLogic Server Clients|WebLogic Server/WebLogic Web Server Plugins
|WebLogic Server/UDDI and Xquery Support|WebLogic Server/Server Examples|Oracle Coherence/Coherence Product Files" />
       <data-value name="INSTALL_NODE_MANAGER_SERVICE" value="yes" />
       <data-value name="NODEMGR_PORT" value="5556" />
       <data-value name="INSTALL_SHORTCUT_IN_ALL_USERS_FOLDER" value="yes"/>
   </input-fields> 
</bea-installer>

-> For Jar Installers:
Open a command prompt and start the installation by executing the below command.

java -jar wls1036_generic.jar -mode=silent -silent_xml=/path//silent.xml -log=/opt/softwares/Installation_silent.log 

It opens up a new windows showing the installation progress.Check the install progress window and a successful install would display message like below

————————————————————————————————————————————-

-> Install the Webcenter Portal

->  cd /u01/software/ofm_wc_generic_11.1.1.8.0_disk1_1of1/Disk1
->  ./runInstaller -silent -responseFile /u01/software/scripts/custom_installtype_wcp11.1.1.8.rsp -jreLoc /u01/app/oracle/product/java_current/jre

Here is the custom_installtype_wcp11.1.1.8.rsp file.You need an response file to provide parameter while installation.

[ENGINE]

#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0

[GENERIC]

#Set this to true if you wish to specify a directory where latest updates are downloaded. This option would use the software updates from the specified directory
SPECIFY_DOWNLOAD_LOCATION=false

#
SKIP_SOFTWARE_UPDATES=true

#If the Software updates are already downloaded and available on your local system, then specify the path to the directory where these patches are available and set SPECIFY_DOWNLOAD_LOCATION to true
SOFTWARE_UPDATES_DOWNLOAD_LOCATION=

#Provide the Oracle Home location. The location has to be the immediate child under the specified Middleware Home location. The Oracle Home directory name may only contain alphanumeric , hyphen (-) , dot (.) and underscore (_) characters, and it must begin with an alphanumeric character. The total length has to be less than or equal to 128 characters. The location has to be an empty directory or a valid WebCenter Oracle Home.
ORACLE_HOME=/home/middleware/Oracle_WC1

#Provide existing Middleware Home location.

MIDDLEWARE_HOME=/home/middleware
#Application Server choices are WLS, WAS

APPSERVER_TYPE=WLS

[SYSTEM]
[APPLICATIONS]
[RELATIONSHIPS]

————————————————————————————————————————————-

-> Create database schemas via the RCU

Creating schema using silent instillation you provide password in txt file.Below command will create different schema.

	
 cd ofm_rcu_linux_11.1.1.8.0_disk1_1of1/rcuHome/bin
 ./rcu -silent -createRepository -databaseType ORACLE -dbUser sys
 -connectString localhost:1521:orcl  -dbRole SYSDBA
 -useSamePasswordForAllSchemaUsers -schemaPrefix DEV
 -component PORTLET -tablespace WP_REPO -tempTablespace TEMP
 -component MDS -tablespace WP_REPO -tempTablespace TEMP
 -component WEBCENTER -tablespace WP_REPO -tempTablespace TEMP
 -component ACTIVITES -tablespace WP_REPO -tempTablespace TEMP
 -f < passwordfile.txt

This will create 3 schema’s: DEV_PORTLET, DEV_MDS, DEV_WEBCENTER,DEV_ACTIVITES.
The passwordfile.txt file would contain, in order:

database_password
component1_schema_password
component2_schema_password

Happy weblogic/Webcenter installation with Vinay Kumar in techartifact

Start Weblogic and managed server through script

Requirement– you set weblogic, database and all managed server.You don’t want to go command prompt and start servers.You can start everythng by script in linux environment

Implementation– Please follow below script to start everything by a normal GUI as below –

StartServer

Create a new file and copy below script.You have to change ORACLE_HOME,ORACLE_SID and DOMAIN_HOME according to your machine.Save as extension of .sh .
Double click that file you will see above screen.enter 1 ,2 or following numbers to start and stop the server.

#!/bin/bash

DATE=`date +%A" "%d-%b-%Y-%X`

DATESTAMP=`date +%d-%b-%Y-%T`

clear

echo "************************************************************************"

echo "**********************   ControlCenter   ************************"

echo "************************************************************************"

echo " "

echo "                    "$DATE"

                    "

echo " "


echo " "

echo "1.  START Oracle Database and Listener "

echo "2.  START Oracle Weblogic Server [AdminServer]"

echo "3.  START Oracle UCM [UCM_server1] "

echo "4.  START Oracle Portlet [WC_Portlet] "

echo "5.  START Oracle Utilities [WC_Utilities] "

echo "6.  START Oracle Spaces [WC_Spaces] "

echo " "

echo "7.  STOP Oracle Portlet [WC_Portlet] "

echo "8.  STOP Oracle Utilities [WC_Utilities] "

echo "9.  STOP Oracle UCM [UCM_server1] "

echo "10. STOP Oracle Spaces server [WC_Spaces] "

echo "11. STOP Oracle Weblogic Server [AdminServer] "

echo "12. STOP Oracle Database and Listener "

echo " "

echo "X.  EXIT from this Menu "

echo "************************************************************************"



#export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1

#export PATH=$ORACLE_HOME/bin:$PATH

#export ORACLE_SID=orcl

#export LD_LIBRARY_PATH=$ORACLE_HOME/lib

#export DOMAIN_HOME=/home/oracle/Oracle/Middleware/user_projects/domains/ucm_domain



export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=orcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export DOMAIN_HOME=/u01/app/oracle/Oracle/middleware/user_projects/domains/ucm_domain



ADMIN_PORT=7001
UCM_PORT=16200
PORTLET_PORT=8889
SPACES_PORT=8888
UTILITIES_PORT=8891



#echo "\n X.  Exit from Menu"

echo "Enter the Administration Option (X to exit menu):"
read ADMINTASK

#

if [[ -z $ADMINTASK ]]; then

   echo "Please enter a numeric value from the Menu!"

else

case $ADMINTASK in



#---------------------------------------------------------------------------------------------



"101")

clear

#

lsnr_num=`ps -ef|grep tnslsnr |grep -v grep |awk 'END{print NR}'`



if [ $lsnr_num -gt 0 ]

then echo "Database Listener Already RUNNING."

else echo "Starting Infrastructure Database Listener..."

$ORACLE_HOME/bin/lsnrctl start

fi



db_num=`ps -ef|grep pmon |grep -v grep |awk 'END{print NR}'`



if [ $db_num -gt 0 ]

then echo "Database Already RUNNING."

else echo "Starting Oracle Database ..."

$ORACLE_HOME/bin/sqlplus "/ as sysdba" <<EOF

#connect sys/welcome1 as sysdba

startup

EOF

#



sleep 10

echo "Database Services Successfully Started. "

#

fi





admin_num=`ps -ef|grep "$ADMIN_PORT" |grep -v grep |awk 'END{print NR}'`



if [ $admin_num -gt 0 ]

then echo "WebLogic Admin Server Already RUNNING."

else echo "."

cd $DOMAIN_HOME/bin



echo "Starting WebLogic Admin Server...."

nohup ./startWebLogic.sh > weblogic.out &

admin_run=`grep -i RUNNING weblogic.out|grep -v grep |awk 'END{print NR}'`

while [ $admin_run -eq 0 ]

do

sleep 5;

admin_run=`grep -i RUNNING weblogic.out|grep -v grep |awk 'END{print NR}'`

done



echo "Starting UCM_server1...."

nohup ./startManagedWebLogic.sh UCM_server1 > ucm.out &

sleep 5;

ucm_run=`grep -i "Server started in RUNNING mode" ucm.out|grep -v grep

|awk 'END{print NR}'`

while [ $ucm_run -eq 0 ]

do

sleep 5;

ucm_run=`grep -i "Server started in RUNNING mode" ucm.out|grep -v grep

|awk 'END{print NR}'`

done



fi

;;



#---------------------------------------------------------------------------------------------





#---------------------------------------------------------------------------------------------



"1")

clear

#

lsnr_num=`ps -ef|grep tnslsnr |grep -v grep |awk 'END{print NR}'`



if [ $lsnr_num -gt 0 ]

then echo "Database Listener Already RUNNING."

else echo "Starting Infrastructure Database Listener..."

$ORACLE_HOME/bin/lsnrctl start

fi



db_num=`ps -ef|grep pmon |grep -v grep |awk 'END{print NR}'`



if [ $db_num -gt 0 ]

then echo "Database Already RUNNING."

else echo "Starting Oracle Database ..."

$ORACLE_HOME/bin/sqlplus "/ as sysdba" <<EOF

#connect sys/welcome1 as sysdba

startup

EOF

#

sleep 10

echo "Database Services Successfully Started. "

#

fi

;;



#---------------------------------------------------------------------------------------------



"2")
echo "Starting WLS_Admin ...."
admin_num=`netstat -nl|grep "$ADMIN_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $admin_num -gt 0 ]
then echo "WebLogic Admin Server Already RUNNING."
else echo "."
cd $DOMAIN_HOME/bin
echo "Starting WebLogic Admin Server...."
nohup ./startWebLogic.sh > weblogic.out &
sleep 5;
admin_run=`grep -i "Server started in RUNNING mode" weblogic.out|grep -v grep |awk 'END{print NR}'`
while [ $admin_run -eq 0 ]
do
sleep 5;
admin_run=`grep -i "Server started in RUNNING mode" weblogic.out|grep -v grep |awk 'END{print NR}'`
done
fi
;;



#---------------------------------------------------------------------------------------------

"3")

ucm_num=`netstat -nl|grep "$UCM_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $ucm_num -gt 0 ]
then echo "UCM_server1 Already RUNNING."
else echo "."
cd $DOMAIN_HOME/bin
echo "Starting UCM_server1...."
nohup ./startManagedWebLogic.sh UCM_server1 > ucm.out &
sleep 5;
ucm_run=`grep -i "Server started in RUNNING mode" ucm.out|grep -v grep |awk 'END{print NR}'`
while [ $ucm_run -eq 0 ]
do
sleep 5;
ucm_run=`grep -i "Server started in RUNNING mode" ucm.out|grep -v grep |awk 'END{print NR}'`
done
fi
;;


#---------------------------------------------------------------------------------------------


"4")

portlet_num=`netstat -nl|grep "$PORTLET_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $portlet_num -gt 0 ]
then echo "WC_Portlet Already RUNNING."
else echo "."
cd $DOMAIN_HOME/bin
echo "Starting WC_Portlet...."
nohup ./startManagedWebLogic.sh WC_Portlet > portlet.out &
sleep 5;
portlet_run=`grep -i "Server started in RUNNING mode" portlet.out|grep -v grep |awk 'END{print NR}'`
while [ $portlet_run -eq 0 ]
do
sleep 5;
portlet_run=`grep -i "Server started in RUNNING mode" portlet.out|grep -v grep |awk 'END{print NR}'`
done
fi
;;


#---------------------------------------------------------------------------------------------

"5")

utilities_num=`netstat -nl|grep "$UTILITIES_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $utilities_num -gt 0 ]
then echo "WC_Utilities Already RUNNING."
else echo "."
cd $DOMAIN_HOME/bin
echo "Starting WC_Utilities...."
nohup ./startManagedWebLogic.sh WC_Utilities > utilities.out &
sleep 5;
utilities_run=`grep -i "Server started in RUNNING mode" utilities.out|grep -v grep |awk 'END{print NR}'`
while [ $utilities_run -eq 0 ]
do
sleep 5;
utilities_run=`grep -i "Server started in RUNNING mode" utilities.out|grep -v grep |awk 'END{print NR}'`
done
fi
;;



#---------------------------------------------------------------------------------------------

"6")

spaces_num=`netstat -nl|grep "$SPACES_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $spaces_num -gt 0 ]
then echo "WC_Spaces Already RUNNING."
else echo "."
cd $DOMAIN_HOME/bin
echo "Starting WC_Spaces...."
nohup ./startManagedWebLogic.sh WC_Spaces > spaces.out &
sleep 5;
spaces_run=`grep -i "Server started in RUNNING mode" spaces.out|grep -v grep |awk 'END{print NR}'`
while [ $spaces_run -eq 0 ]
do
sleep 5;
spaces_run=`grep -i "Server started in RUNNING mode" spaces.out|grep -v grep |awk 'END{print NR}'`
done
fi
;;


#---------------------------------------------------------------------------------------------



"7")

echo "Stopping  Oracle Portlet [WC_Portlet] ... "

cd $DOMAIN_HOME/bin

./stopManagedWebLogic.sh WC_Portlet

;;





#---------------------------------------------------------------------------------------------



"8")

echo "Stopping  Oracle Utilities [WC_Utilities] ... "

cd $DOMAIN_HOME/bin

./stopManagedWebLogic.sh WC_Utilities

;;


#---------------------------------------------------------------------------------------------



"9")

echo "Stopping  Oracle UCM [UCM_server1] ... "

cd $DOMAIN_HOME/bin

./stopManagedWebLogic.sh UCM_server1

;;


#---------------------------------------------------------------------------------------------



"10")

echo "Stopping Webcenter Spaces [WC_Spaces] ..."

cd $DOMAIN_HOME/bin

./stopManagedWebLogic.sh WC_Spaces

;;




#---------------------------------------------------------------------------------------------



"11")

echo "Stopping Admin Server [WLS_Admin] ..."

cd $DOMAIN_HOME/bin

./stopWebLogic.sh

;;



#---------------------------------------------------------------------------------------------



"12")

echo "Stopping Oracle Database and Listener ..."

$ORACLE_HOME/bin/sqlplus "/ as sysdba" <<EOF

#connect sys/welcome1 as sysdba

shutdown immediate

EOF

#





$ORACLE_HOME/bin/lsnrctl stop

sleep 10;

lsnr_num=`ps -ef|grep tnslsnr |grep -v grep |awk 'END{print NR}'`



if [ $lsnr_num -gt 0 ]

then kill -9 `ps -deafw | grep "$ORACLE_HOME" | grep -v grep |  awk

'{print $2}' | paste -s -d" " -`

fi

;;



#---------------------------------------------------------------------------------------------



"100")

clear



cd $DOMAIN_HOME/bin



echo "Stopping Database,IBR_Server1, UCM_Server1 ..."

./stopManagedWebLogic.sh IBR_server1

./stopManagedWebLogic.sh UCM_server1

./stopWebLogic.sh



echo "Stopping Oracle Database and Listener ..."

$ORACLE_HOME/bin/sqlplus "/ as sysdba" <<EOF

#connect sys/welcome1 as sysdba

shutdown immediate

EOF

#

$ORACLE_HOME/bin/lsnrctl stop

sleep 10;

lsnr_num=`ps -ef|grep tnslsnr |grep -v grep |awk 'END{print NR}'`



if [ $lsnr_num -gt 0 ]

then kill -9 `ps -deafw | grep "$ORACLE_HOME" | grep -v grep |  awk

'{print $2}' | paste -s -d" " -`

fi

;;



#---------------------------------------------------------------------------------------------

"X")
clear
exit
;;
esac
fi
controlscript.sh


 

Happy learning with Vinay Kumar in techartifact….