Tuesday, November 3, 2009

Autodeploy on WebLogic 11g

Today I want to test Sun One WebServer 7 proxy plug-in with WebLogic 11g. Mr. Prasanna yalam suggested to use autodeploy of simple Jsp to the connectivity.
To Autodeploy a web application in WebLogic Standalone AdminServer we need to follow the steps:1. create a Exploded folder say for example 'myweb' in domain_name/autodeploy folder2. create a Test.jsp file using any editor



Hello from WebLogic

Pavan Devarakonda

save this fileat the same folder create WEB-INF folder 3. create web.xml deployment descriptor file4. touch WEB-INF/REDEPLOY create this file for new timestamp when AdminServer lookup for the autodeployments.
verify this on the console deployments section.choose Testing tab and click on the url with Test.jsp that's all you need to do..It will give you the autodeployed application output on your browser.
Ref:http://download.oracle.com/docs/cd/E13222_01/wls/docs92/deployment/autodeploy.html#wp1021620

Tuesday, August 11, 2009

JVM monitoring with jstat Shell Script

The Oracle WebLogic Server instances are nothing but each one running on a single JVM, when this JVM crashes there could be one of the reasons as overworking of Garbage Collection or not working at all (waiting continuously).  

It is good practice that monitoring GC in JVM with detailed statistics will give you a clear idea to analysis at what circumstances happening wrong. And the best way to look in deeper levels of garbage collection also like Young Generation (Eden space, Survivor spaces S0, S1) Old Generation (tenured Generation), and Perm Generation (Statistic Objects/Classes).

JDK 1.5 and latest providing excellent JDK command utilities for interrogate the current running Java Process and look inside of JVM take snap with following:
1. jps (Java Process)
2. jstat (JVM status)

The 'jps' command with -lv options gives you complete detailed java process arguments for MEM settings and relavent WebLogic Server instances name. We have already discussed about this command utility in another post.

The jstat command with -gc option will produce the Garbage Collection of given java process id.

GC Monitoring shell script with jstat tool

I have modified according to my convenience and requirements as a shell script that will take the argument as WebLogic Server instance name and give us the output as statistics of Young, Old, Perm Generations Current, Used Memory details in MB conversion function.

##############################################################
# Purpose:  To display current, used spaces for an instance 
#   in the JVM Eden, Old, Perm sizes
# Author:  Pavan Devarakonda
##############################################################
# Function for converting the Kilo bytes to Mega Bytes.
toMb()
{
        echo 'scale=0;'$1'/1024' | bc; 
} 

#=============================================
# JVM status Function starts here
#=============================================
instJvm()
{
        DATA=`$JAVA_HOME/bin/jstat -gc $PID | grep -v S0C`
         
        EC=`echo $DATA | awk '{print $5}'`
        EU=`echo $DATA | awk '{print $6}'`
        OC=`echo $DATA | awk '{print $7}'`
        OU=`echo $DATA | awk '{print $8}'`
        PC=`echo $DATA | awk '{print $9}'`
        PU=`echo $DATA | awk '{print $10}'`
        echo -e  "$2\t|" `toMb $EC`"M   "`toMb $EU`"M\t| "`toMb $OC`"M   "`toMb $OU`"M\t| "`toMb $PC`"M   "`toMb $PU`"M"
}
#=============================================
# main starts here
#=============================================
 
 
echo -e "=============================================================="
echo -e " Instance\t |    Eden    \t|    Old Gen   \t|    Perm Gen"
echo -e "         \t |Current Used\t| Current Used \t| Current Used"
echo -e "=============================================================="
 
DOMAIN_HOME=$1

for i in ` ls $DOMAIN_HOME/servers/|grep -v bkp`
do 
        PID=`$JAVA_HOME/bin/jps -lv | grep $i | awk '{print $1}'`
        if [ "$PID" != ""  ]
        then    
                instJvm $PID $i
        fi      
done
echo -e "=============================================================="
Example execution:
  ./jstat_mon.sh  /u01/domains/apex_domain
  
The output as follows:

The jstat command using script
        

Taking Advantage of Naming Conventions


In most of the Middleware environments, the WebLogic domain will have admin servers, managed servers use naming convention construct that will have some common identity for each domain unique. In the above example, The domain uses naming convention with the letter 'c', This can be any word or letter that is used in your environment. To make your script you need to replace 'c' with your enviroment key word/letter. (Thanks Raman Jain for your valuable comment)

Let me show you the sample Output:

Looking ahead to your valuable comments and suggestions to improve our scripting tricks for better WebLogic Administration.

The jstat Command reference:

Saturday, April 25, 2009

WebLogic Server cluster status

Some times the WebLogic Server logs showing that one of the managed server removed from the cluster... How to confirm in faster way or from commandline...
it is pretty simple way is...



java  weblogic.Admin -url adminserver:port -username user -password passwd CLUSTERSTATE -nameofthecluster

Tuesday, March 24, 2009

Editing config.xml in WebLogic Server

My experience on experimenting with WebLogic domains repository that is config.xml. It was a challenging experiment, where the WebLogic 9.2 MP3 was the version on which I did this workout. Here the basic thing need to know is how the config.xml is constructed and referring to the "http://www.oracle.com/technology/weblogic/90/security/wls.xsd". This is the major change new versions using XSD to ensure that quality of XML is wellformed in the config.xml

Before editing the config.xml

Smart Admin always prefer to take backup before editing the config.xml. You need to take a complete backup that should include the jdbc, jms directories if already created. To ensure complete backup of configuration use the following command:
cp -R config config_date

Editing with vi editor

Here you need to have little wise thinker to understand about complexType, simpleType, sequance these all XML schema types and used to define the xml instances (xsi). 
What we can edit in the config.xml file?
1. We can replicate the server instances.
2. We can replicate the cluster instances.
3. We can replicate the machine configurations.

Replace of existing configuration details with new details can be done in vi editor trick
: %s/oldtext/newtext/g

Some times you need to change the configuration data after certain lines you can use line number followed by $s and replace things.
: 10,$s/oldtext/newtext

Here the g option at the ending is optional that can be used to global replacement.

Deleting tricks in vi editor

I have seen many of my fellow team members, especially development guys are not aware of using vi editor. Usually people acustomized to use FileZilla or WinScp to download the file that they want to edit and saving will be two step process, saves in the local window machine one temprory file then that will be uploaded back. If there is network latency or blinks in the network due to geographical distances file may not saome, rework! My suggestion is better you know some vi editor tricks you play wth it, that does your work quicker and faster ability to edit your text in the most of Unix systesms.
Here we go with Esc key followed by
dd - for deleting the complete line from anywhere on the line in vi
d10 delete the number of linkes here it is given as 10 lines
dw - delete word
d$ - delete from the current position to till end of line

Goto the Word

In most of the cases friends move the UP arrow and DOWN arrows in the keyboard to check for the changes impacted or not. Better to use our vi search using "/" (slash) it will takes you directly to the text which you are searching for. Well now it is about config.xml where you need to search for the text you wish to change let's say 'listen' it will be used for Admini server, Managed servers where you need to change listen-address or listen-port etc.

Don't does

What we should not touch(cannot change)?
1. Security settings -- realm details
2. Encrypted password for nodemanager, adminuser, database ...


What are the basic changes observed compared to WebLogic 8.1?
1. The configuration in the 8.1 is un-ordered as and when you configured new resource that will be appended at the end. whereas in the WebLogic 9.x it is very clear that follows the XML Schema Definitions so we cannot place a tag line up or down, it follows strict rules defined in domain.xsd.

2. The schema definition clearly mentioned that an element if selected to place in the config.xml that, we need to check for parent element, data type (string, boolean, number etc..), most important one is variable values true or false. 

Blurb about this blog

Blurb about this blog

Essential Middleware Administration takes in-depth look at the fundamental relationship between Middleware and Operating Environment such as Solaris or Linux, HP-UX. Scope of this blog is associated with beginner or an experienced Middleware Team members, Middleware developer, Middleware Architects, you will be able to apply any of these automation scripts which are takeaways, because they are generalized it is like ready to use. Most of the experimented scripts are implemented in production environments.
You have any ideas for Contributing to a Middleware Admin? mail to me wlatechtrainer@gmail.com
QK7QN6U9ZST6