Showing posts with label Weblogic Server. Show all posts
Showing posts with label Weblogic Server. Show all posts

Weblogic Server Health checking Script

# Modify classpath to as per the weblocic server location in your environment
# The script takes 3 parameters
# The first parameter is the admin url
# The second parameter is the Username of admin server
# The third parameter is the password of admin server

CLASSPATH="/usr/java/lib/tools.jar:/apps/weblogic/server/lib/weblogic_sp.jar:/apps/weblogic/server/lib/weblogic.jar:/apps/weblogic/server/lib/ojdbc14.jar:"
export CLASSPATH
PATH="/apps/weblogic/server/bin:/usr/java/jre/bin:/usr/java/bin:/osmf/mgmt/condir/cft/BT/BTOPUT/bin/SSOL2:/usr/bin:/usr/ucb:/etc::/osmf/mgmt/condir/cft/cft/filexe:/osmf/mgmt/condir/cft/cft/filusr:/osmf/mgmt/condir/cft/cft/filexit:/osmf/mgmt/condir/cft/cft/filapi:/u01/app/oracle/product/8.1.7/bin:/apps/abinitio/bin"
export PATH
java weblogic.Admin -adminurl $1 -username $2 -password $3 GET -pretty -type ServerRuntime
java weblogic.Admin -adminurl $1 -username $2 -password $3 GET -pretty -type JVMRuntime
java weblogic.Admin -adminurl $1 -username $2 -password $3 GET -pretty -type JDBCConnectionPoolRuntime
java weblogic.Admin -adminurl $1 -username $2 -password $3 GET -pretty -type ExecuteQueueRuntime

Script to restart the weblogic server using crontab in unix without any manual intervention

Problem Description

This script can be used to restart the weblogic server using crontab in unix without any manual intervention.


Solution Description

This script can be used to restart the weblogic server without any manual intervention. It also sends email to the list of people once the restart is done.We can add few more manipulations if you need before restarting the weblogic server. This can be enabled through crontab in the unix.


Code Snippet

#! /bin/ksh

#This script is used for restarting the Weblogic server using CRONTAB

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

# Mail list is used to email the list of users once the restart is done

Maillist=" "

# Mail file is the file which will get emailed to the mail list users

Mailfile= " "

#This is the temporary log file where stopWeblogic.sh result will be stored

> Stop_log

# Stopping the Server

echo "Stopping Weblogic server"

. ./stopWebLogic.sh > Stop_log 2>& 1

sleep 90

echo "Confirming that the Weblogic server stopped"

. ./stopWebLogic.sh >> Stop_log 2>& 1

# Searching for the exception when you shut down the weblogic server for the second time

egrep '[Destination unreachable | "OPUSServer" was shutdown successfully]' Stop_log > /dev/null

if [ $? -eq 0 ]

then

echo "Weblogic server stopped successfully"

# Starting the Server

echo "Trying to start Weblogic server"

#. ./startWebLogic.sh > Start_log 2>& 1 &

. ./startWebLogic.sh > /dev/null

#Getting the process id for startWebLogic.sh process

id=$!

i=0

until [ $i -gt 1 ]

do

sleep 90

grep "Server started in RUNNING mode" /prod/opus/OPUS_CONS1/logs/wl-domain.log > /dev/null

if [ $? -eq 0 ]

then

echo "Weblogic server started successfully"

#Killing the process startWebLogic.sh using process id

#kill -9 $id

#echo "Killed startweb"

break

fi

i=`expr $i + 1`

done

if [ $i -ne 2 ]

then

echo "Weblogic server restarted successfully"

mailx -s "Weblogic_server name Restarted Succesfully" -r $Maillist < $Mailfile


else

echo "Weblogic server failed to start"

mailx -s "Weblogic_server name failed to start" -r $Maillist

fi

else

echo "Failed to stop Weblogic server"

mailx -s "Failed to stop Weblogic server" -r $Maillist

fi

echo "Completed the script"

exit

Differences between weblogic Versions 8 Vs 9/10

Weblogic 8
Weblogic 9/10
Console is an applet and uses JCX JCS JPF and Netui page flows Console is portal and uses JSTL (JSP 2.0)
No folder called config Folder called config is available
No Prepare state for application. Only active state Prepare state for application, This optimises memory utilization.
No app inf lib and classes App inf lib and app inf classes are added
Persistant store is defined Under JMS Persistant store is defined Under JDBC
We have connection pools and datasources We have datasources and connection pools are inside datasources.
We have exclude queues. We have work managers
No lock and edit Lock and edit is the new feature
We need to delete and redeploy from admin console We can update the application using admin console
All configuration information is in one config.xml Seperate xml files for domain config and jms modules are added
No concept of JMS modules and sub deployments Jms modules and subdeployments are included.
Queue/topic is configured under distributed destination Queue/topic/dd etc are all clubbed in a JMS modules
Side by site deployment is not possible Side by side deployment is possible
Server dosent come up if deployment fails Server boots in ADMIN mode if deployment failes

Can WebLogic Server start with a UNIX boot ?

You can add a startup script to your UNIX rc scripts to run WebLogic Server at UNIX boot time. Here is an example from an HP-UX 11 system, running under JDK 1.1. You need to supply the URL for your WebLogic Server and your system password. This file, wlstart, is placed in the /sbin/init.d directory and there is a link to it in the /sbin/rc2.d directory:

export SHLIB_PATH=\
/home/user1/weblogic/lib/hpux11:/oracle/8.0.4/lib
export CLASSPATH=/home/user1/weblogic/classes:\
/home/user1/weblogic/lib/weblogicaux.jar
export ORACLE_HOME=/oracle/8.0.4
export ORACLE_SID=DEMO
export ORACLE_TERM=vt100
export QAT=/home/user1/weblogic
cd $QAT
PATH=/sbin:/usr/sbin:/usr/bin:/opt/java/bin
export PATH
case $1 in
'start')
java -ms64m -mx64m -verbosegc weblogic.Server > \
/home/user1/weblogic/server.out 2> #emp;
;;
'stop')
java weblogic.Admin URL shutdown system password
;;
*)
echo "usage: $0 {start|stop}"
;;
esac

You should work with your UNIX system administrator to set up scripts similar to this for your system.

WebLogic Session Replication Issues



Hi,
USEFUL Debuging techinques:Most of the Time we find Session Replication related Issues while using the Clustering Features of Weblogic.
Enable the Debug Flags to track Session Replication Failures:
You could enable the flags DebugCluster, DebugClusterAnnouncements, DebugFailOver, DebugReplication, DebugReplicationDetails.
To Enable: You can use the weblogic.Admin command line utility to dynamically turn the debug options on and off.
For example, to turn on DebugCluster on all administration instances of ServerDebug Mbean (i.e., Admin Server or al Managed Server):
java weblogic.Admin -url t3://localhost:7001 -username system -password weblogic SET -type ServerDebug -property DebugCluster true
***Symptoms***:
1). After Logging into the Application which is deployed on WebLogic Cluster… Users suddenly finds themself to be redirected to Login page again even if they haven’t clicked on Logout Button.
2). In these cases There may be many reasons behind this…There may be Multicast Issues(Network Issues) in the Network where the WebLogic Clusters are running. Means Managed Servers which is part of the Cluster are not able to send Heartbeat messages to eachother. In these kind of scenario first of all we need to Apply the Multicast Test Utility provided as part of WebLogic. For more Informations you can refer to “http://download-llnw.oracle.com/docs/cd/E13222_01/wls/docs81/admin_ref/utils25.html” Multicast Util Informations.
3). Getting java.io.NotSerializableException” in Server Logs
4). May be the Default Session Cookie Name is different in “weblogic.xml” and It’s not same as the WebProxy Default Cookie Name.
PARAMETERDEFAULTDESCRIPTIONAPPLICABLE TO
CookieNameJSESSIONIDIf you change the name of the WebLogic Server session cookie in the WebLogic Server Web application, you need to change the CookieName parameter in the plug-in to the same value. The name of the WebLogic session cookie is set in the WebLogic-specific deployment descriptor, in theelement.Note: TheCookieName parameter has been renamed as WLCookieName. A warning message is issued if you continue to use the old parameter name.NSAPI, ISAPI, and Apache plug-in, HttpClusterServlet, and HttpProxyServlet
In most of the Cases i have observed that Users get Logged off from our applications which is targeted to a Cluster .is because of the Application. If an application is storing some NonSerializable Data Objects inside the HttpSession as an attribute then the WebLogic Cluster is not able to replicate these Non-Serializable data to the replicated HttpSession on another Secondary Managed Servers. For a Large scale applications it is not an easy task for developers to check the complete code again…sothat they can identify that all the HttpSession Attributes are implementing the java.io.Serializable interface or not.
Here is a simple JSP page which is able to display all the HttpSession attributes in a tabular format along with the report that Which Session Attribute is Not Serializable. We need to Just bundle this JSP inside our existing application which is causing the issue. Then we need to login to our application we need to access this additional page “SerializationTest.jsp” sothat if any HttpSession attribute is already stored inside the HttpSession then it can display it’s complete information.
***NOTE:
Here i am providing a complete TestCase for this JSP…to demonstrate How actually it works..But you need to add only the “SerializationTest.jsp” page inside your application which is causing the issue
SerializationTest.jsp
—————————-
Session Attribute NameSession Attribute ValueSTATUS

—————————-
*********Complete TestCase Below:**********
Just to know how it actually works Just develop a Sample Web Application with the following details
Step1). Develop a classes “Emp.java” here Emp class should NOT implement the “java.io.Serializable” interface.
package pack;
public class Emp
{
String name=”Default Name”;
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name=name;
}
}
Step2). Develop a classes “Salesman.java” here Emp class should implement the “java.io.Serializable” interface.
package pack;
public class Salesman implements java.io.Serializable
{
String name=”Default Salesman Name”;
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name=name;
}
}
Step3). Compile the above two classes and place them inside your WebApplications “WEB-INF/classes” directory
D:\DELETE\SessionTest\WEB-INF\classes> javac -d . Emp.java
D:\DELETE\SessionTest\WEB-INF\classes> javac -d . Salesman.java
Step4). Now provide the “index.jsp” Page as below:
index.jsp
————————

Session Object Created with the Following Attributes:


session.setAttribute(“EmpAttribute”,new pack.Emp());


session.setAttribute(“SalesmanAttribute”,new pack.Salesman());

————————
Step5). Now provide the Sample “web.xml“ we don’t need to enter much information in this file …as it is just a TestCase.
http://java.sun.com/xml/ns/j2ee“>
Step6). Now If you want to enable Session Replication for your WebApplication then provide the “weblogic.xml” file like below…(In our TestCase at present this is not required…as we are just going to test The HttpSession attribute is Serializable or Not. it can be tested in a NonClustered Managed Server as well)

http://www.bea.com/ns/weblogic/90“>

replicated


Step7). Now Deploy your Application in WebLogic Server…
Step 8). Access the “index.jsp” page of your application then you will find the following output:
Thanks

Weblogic Server Cluster Multicast Configuration

____________________________________________________________________


http://middlewareforum.com/weblogic/?page_id=120
Powered by Blogger