Labels

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

Monday, November 25, 2013

command for finding the version of weblogic and installed components

1) Go to installed weblogic server lib path
2)Use this command -----java -cp weblogic.jar weblogic.version -verbose
3) you will get like below details. 

SERVICE NAME                    VERSION INFORMATION
============                    ===================
Kernel                          Commonj WorkManager v1.1
TimerService                    Commonj TimerManager v1.1
CorbaService                    CORBA 2.3, IIOP 1.2, RMI-IIOP SFV2, OTS 1.2, CSI
v2 Level 0 + Stateful
XMLService                      XML 1.1
Transaction Service             JTA 1.0.1B
JDBCService                     JSR-114, JDBC 3.0
CustomResourceServerService     1.0.0.0
Servlet Container               Servlet 2.5, JSP 2.1
WebServices                     JSR-173, JAX-RPC, JSR-109, WSDL, WS-Addressing,
WS-Policy, JAX-B, JAX-R, UDDI, WS-Management(HP), JAXP-1.3, WS-Security
Pre Admin Singleton Services S  1.0
Singleton Services Batch Manag  1.0
EJB Container                   EJB 3.0
MDBService                      EJB 3.0
EJBTimerService                 EJB 3.0
J2EE Connector                  1.5
JMS Service                     JMS 1.1

Tuesday, November 5, 2013

A-Z Linux Commands

Command     Description
alias     Create an alias
apropos     Search manual for keyword
at     Schedule a job to run in the future.
awk     Find and Replace text within file(s)
break     Exit from a loop
builtin     Run a shell builtin
bunzip2     Decompress file from bzip2 format
bzip2     Compress file to bzip2 format
cal     Display a calendar
case     Conditionally perform a command
cat     Concatenate files to standard output
cd     Change Directory
cfdisk     Partition table manipulator for Linux
chgrp     Change group ownership
chmod     Change access permissions
chown     Change file owner and group
chroot     Run a command with a different root directory
chvt     Change the virtual Terminal
cksum     Print CRC checksum and byte counts
clear     Clear terminal screen
cmp     Compare two files
comm     Compare two sorted files line by line
command     Run a command – ignoring shell functions
compress     Compress file(s) to old Unix compress format
continue     Resume the next iteration of a loop
convmv     A perl script that converts filenames from one encoding to another
cp     Copy one or more files to another location
cron     Daemon to execute scheduled commands at predefined time
crontab     Schedule a command to run at a later time
csplit     Split a file into context-determined pieces
cut     Divide a file into several parts
date     Display or change the date & time
dc     Desk Calculator
dd     Data Dump – Convert and copy a file
declare     Declare variables and give them attributes
df     Display free disk space
diff     Display the differences between two files
diff3     Show differences among three files
dir     Briefly list directory contents
dircolors     Colour setup for `ls’
dirname     Convert a full pathname to just a path
dirs     Display list of remembered directories
du     Estimate file space usage
echo     Display message on screen
ed     A line-oriented text editor (edlin)
egrep     Search file(s) for lines that match an extended expression
eject     Eject CD-ROM
enable     Enable and disable builtin shell commands
env     Disp, set, or remove environment variables
eval     Evaluate several commands/arguments
exec     Execute a command
exit     Exit the shell
expand     Convert tabs to spaces
export     Set an environment variable
expr     Evaluate expressions
factor     Print prime factors
false     Do nothing, unsuccessfully
fdformat     Low-level format a floppy disk
fdisk     Partition table manipulator for Linux
fgrep     Search file(s) for lines that match a fixed string
file     Determine type of file
find     Search for files that meet a desired criteria
fmt     Reformat paragraph text
fold     Wrap text to fit a specified width.
for     Expand words, and execute commands
format     Format disks or tapes
free     Disp, s memory usage
fsck     Filesystem consistency check and repair.
fstat     List open files
function     Define Function Macros
fuser     Identify process using file
gawk     Find and Replace text within file(s)
getopts     Parse positional parameters
grep     Search file(s) for lines that match a given pattern
groups     Print group names a user is in
gunzip     Decompress file(s) from GNU zip format
gzcat     Show contents of compressed file(s)
gzip     Compress file(s) to GNU zip format
hash     Remember the full pathname of a name argument
head     Output the first part of file(s)
history     Command History
hostname     Print or set system name
iconv     Converts the encoding of characters from one code page encoding scheme to another.
id     Print user and group id’s
if     Conditionally perform a command
import     Capture an X server screen and save the image to file
info     Help info
install     Copy files and set attributes
join     Join lines on a common field
kill     Stop a process from running
less     Display output one screen at a time
let     Perform arithmetic on shell variables
ln     Make links between files
local     Create variables
locate     Find files
logname     Print current login name
logout     Exit a login shell
lpc     Line printer control program
lpr     Off line print
lprint     Print a file
lprintd     Abort a print job
lprintq     List the print queue
lprm     Remove jobs from the print queue
ls     List information about file(s)
ll     #ls -l List information about file(s)
lsof     List open files
m4     Macro processor
makewhatis     Rebuild whatis database
man     Print manual pages
mkdir     Create new folder(s)
mkfifo     Make FIFOs (named pipes)
mknod     Make block or character special files
more     Display output one screen at a time
mount     Mount a file system
mtools     Manipulate MS-DOS files
mv     Move or rename files or directories
netconfig     Configure your network
nice     Set the priority of a command or job
nl     Number lines and write files
nohup     Run a command immune to hangup
od     View binary files
passwd     Modify a user password
paste     Merge lines of files
pathchk     Check file name portability
popd     Restore the previous value of the current directory
pr     Convert text files for printing
printcap     Printer capability database
printenv     Print environment variables
printf     Format and print data
ps     Process status
pushd     Save and then change the current directory
pwd     Print Working Directory
quota     Display disk usage and limits
quotacheck     Scan a file system for disk usage
quotactl     Set disk quotas
pax     Archive file(s)
ram     ram disk device
rcp     Copy files between two machines.
read     read a line from standard input
readonly     Mark variables/functions as readonly
remsync     Synchronize remote files via email
return     Exit a shell function
rm     Remove (delete) files
rmdir     Remove folder(s)
rpm     RPM Package Manager (was RedHat Package Manager)
rsync     Remote file copy (Synchronize file trees)
screen     Terminal window manager
sdiff     Merge two files interactively
sed     Stream Editor
select     Accept keyboard input
seq     Print numeric sequences
set     Manipulate shell variables and functions
shift     Shift positional parameters
shopt     Shell Options
shutdown     Shutdown or restart linux
sleep     Delay for a specified time
sort     Sort text files
source     Run commands from a file `.’
split     Split a file into fixed-size pieces
strings     print the strings of printable characters in (binary) files.
su     Substitute user identity
sum     Print a checksum for a file
symlink     Make a new name for a file
sync     Synchronize data on disk with memory
tac     Print files out in reverse line order
tail     Output the last part of files
tar     Tape ARchiver
tee     Redirect output to multiple files
test     Evaluate a conditional expression
time     Measure Program Resource Use
times     User and system times
timidity     Play midi files and set up software synth to play midi files with other commands.
touch     Change file timestamps
top     List processes running on the system
traceroute     Trace Route to Host
trap     Run a command when a signal is set(bourne)
tr     Translate, squeeze, and/or delete characters
true     Do nothing, successfully
tsort     Topological sort
tty     Print filename of terminal on stdin
type     Describe a command
ulimit     Limit user resources
umask     Users file creation mask
umount     Unmount a filesystem
unalias     Remove an alias
uname     Print system information
unexpand     Convert spaces to tabs
uniq     Uniquify files (remove all duplicate lines)
units     Convert units from one scale to another
unset     Remove variable or function names
unshar     Unpack shell archive scripts
until     Execute commands (until error)
useradd     Create new user account
usermod     Modify user account
users     List users currently logged in
uuencode     Encode a binary file into 7-bit ASCII characters
uudecode     Decode a file created by uuencode
v     Verbosely list directory contents (`ls -l -b’)
vdir     Verbosely list directory contents (`ls -l -b’)
watch     Execute/display a program periodically
whatis     List manual pages by name
wc     Print byte, word, and line counts of a file
whereis     Report all known instances of a command
which     Locate a program file in the user’s path.
while     Execute commands
who     Print all usernames currently logged in
whoami     Print the current user id and name (`id -un’)
xargs     Execute utility, passing constructed argument list(s)
yes     Print a string until interrupted
zcat     Show contents of compressed file(s)
zip     Compress and archive file(s) to zip format
.period     Run commands from a file

Tuesday, March 5, 2013

LDAP and how is it used by Weblogic server?

Lightweight Directory Access Protocol (LDAP) is a protocol that programs use to look up contact information from a server. Much like a relational database, every LDAP database (or directory) has a schema. An LDAP schema is implemented as a set of object class definitions and attribute definitions.
Some common terms used in LDAP are:
  • dc= domain component
  • o = organization
  • ou= organizational unit
  • cn= common name
  • dn= distinguished name
  • uid= user id
When you need to search for an entry in LDAP, you must provide the base of the search and a filter.
For example:
ldapsearch -b "dc=beasys,dc=com" uid=fred
This will return all the attributes of the user who has uid=fred as specified in the filter:
uid=fred,ou=People, dc=beasys,dc=com   //this is what is referred to as Full DN
objectClass=top
objectClass=person
objectClass=organizationalPerson
objectClass=inetorgperson
givenName=Fred
cn=Fred A
uid=fred
sn=A
creatorsName=uid=admin,ou=administrators,ou=topologymanagement,o=netscaperoot
modifiersName=uid=admin,ou=administrators,ou=topologymanagement,o=netscaperoot
createTimestamp=20040108160418Z
modifyTimestamp=20040108162837Z

This entry is seen in the LDAP tree as the following:

dc=beasys,dc=com
/     (root)          \
/                          \
/                             \
ou=people             ou=otherusers
/
uid=fred

WLS can read and search information from an external directory server, giving it the right configuration information to connect, bind, search (base and filter), etc.

For this you need to configure the following fields in WLS:
  • LDAP server host and port
  • Principal/password used to connect and make the search
  • User Base DN: used as a base when making a user search
  • User filter: used as a filter when making a user search
  • Group Base DN: used as a base when making a group search
  • Group filter: used as a filter when making a group search
  • Group membership filter: used as a filter when doing a search to find groups a user belongs to
Within these fields, you can find the following characters:
%u is replaced by the user id
%g is replaced by the group
%M is replaced by the Full DN of the user

When WLS needs to verify that a user exists and has privilege/role to access a resource, it connects to LDAP using the principal defined and then does a search on the user, verifies that it exists, and authenticates using its password. After that, it searches the groups the user belongs to.
Following is some concise pseudocode for the membership check algorithm:
check_membership(group g, principal p):
for each group g1 that contains p directly:
if g1 == g or check_membership(g, g1)
then return success
return failure

Once this is done, WLS verifies if the user that belongs to the groups found has the privilege/role to access the resource requested, and based on that either permits the access or denies it.

Common LDAP servers used in WLS

The common LDAP servers used in WLS (as authentication providers) are:
  • Default Authenticator (Embedded LDAP)
  • IPlanet
  • Active Directory
  • OpenLDAP
  • Novell

Friday, October 5, 2012

Why do we set -Xms and -Xmx to the same value?

There is an additional performance overhead when the memory grows from the initial -Xms to -Xmx when system requires additional memory due to reasons like load etc. Its recommended to have the -Xmx and -Xms of the same value so that during the JVM startup process itself the memory is allocated and overhead due to additional progressive growth is avoided. Now in this sense the question remains then why have an -Xms setting in the first place. There might be systems that rarely reach the -Xmx heap value and hence to optimize resource utilization the -Xms setting makes sense. 


 config can prevent overhead of memory manipulating and decrease frequency of garbage collection :)
 

Thursday, September 13, 2012

How to Disabling and enabling the Weblogic 12c Administration Console?

For disable:
1. Select your domain name in the Domain Structure panel of the console(as base_domain below).

     2. Select Configuration | General, and click Advanced at the bottom of the page, and unselect Console Enabled.
OR
Using WLST:-
connect(“username”,”password”)
edit()
startEdit()
cmo.setConsoleEnabled(false)
save()
activate()
disconnect()
exit()
3. For enable, you can use WLST. The following code shows how to do it:
connect(“username”,”password”)
edit()
startEdit()
cmo.setConsoleEnabled(true)
save()
activate()
disconnect()
exit()

Best way to take Thread Dumps in Oracle WebLogic12c Server?

Below are the different ways on taking java thread dumps in a WebLogic Server environment.
Thread dumps are very useful to analyze and troubleshoot performance related issues such as server hang, deadlocks, slow running, idle or stuck applications,  etc.
Different ways to take thread dumps in WebLogic Server
Always prefer Operating system(OS) commands rather instead of Admin Console or Java Classes, because if the console is hanging, users won’t be able to connect to it to issue thread dumps.
1. OS Commands for Thread Dumps
i) On Windows,
<ctrl>+<break> — the thread dumps are generated in the server stdout
ii) On Solaris / Linux
first identify the process ID (pid) using   ps -ef | grep java, then run   kill -3 <pid> td_filename 2>&1
2. Using weblogic.WLST ( work only from WLS 9.x onwards)

First set CLASSPATH using setDomain.cmd or setDomain.sh (wlst.sh /wlst.cmd will also do in path C:\Oracle\Middleware\wlserver_12.1\common\bin ). Then run below command
java weblogic.WLST ThreadDumps.py
save below code in ThreadDumps.py file:
connect(“<username>”,”<password>”,”t3://<url>:<port>”)
cd(‘Servers’)
cd(‘AdminServer’)
threadDump()
disconnect()
exit()
threadDump()
The thread dumps get stored in the location from where you run it.
3. From Weblogic Administration Console
navigating to Server -> <server_name> -> Monitoring -> Dump threads stack.
4. From the JRockit Command line
jrcmd <pid> print_threads

Thursday, September 6, 2012

Whar are the main 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 execute 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 side 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

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

#! /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

Tuesday, August 21, 2012

Daily use weblogic admin Linux Commands ?

To view System Resource Information

uname --help

uname -r

grep model /proc/cpuinfo

grep MemFree /proc/meminfo

sudo -u root lastcomm -f /var/account/pacct

cat /proc/version

# cat /proc/cpuinfo

# cat /proc/meminfo

# cat /proc/zoneinfo

# cat /proc/mounts

cat /etc/redhat-release

grep MemTotal /proc/meminfo

grep SwapTotal /proc/meminfo

df -k /tmp

grep "model name" /proc/cpuinfo

ifconfig (/sbin/ifconfig)

uaname -r

lshal:detected hardware

rpm -qa:  display pakage

rpm -qa | less

Linux Kernel Information:


cat /etc/sysctl.conf

cat /etc/hosts

/sbin/ifconfig

Uname -r

cat /etc/security/limits.conf

cat /proc/sys/kernel/sem

cat /proc/sys/kernel/shmmax

cat /proc/sys/kernel/shmall

cat /proc/sys/kernel/shmmni

cat /proc/sys/fs/file-max

cat /proc/sys/net/ipv4/ip_local_port_range

/sbin/lsmod

cat /etc/issue

sysctl -a | grep shm

sysctl -a | grep ip_local_port_range

/etc/inittab:  init process determines which runlevel it should be

w, ps -a, ps -Alf, ps -AlFH, ps -AlLm

ps -u oracle, ps -u anguyen

Commands to monitor bottlenecks such as Disk, Memory / CPU/Network, or System Activity:

top ? t, m, A: top consumer, r: renice, o: interactively select

vmstat 3, vmstat -m:memority slab info, vmstat -a

w, ps -a, ps -Alf, ps -AlFH, ps -AlLm

ps -u oracle, ps -u attunity

uptime

free

fee -s 2

watch -n 3 -d free

watch -d cat /proc/meminfo

sar -B -f /var/log/sa/sa14

sar -W -f /var/log/sa/sa14

vmstat -m

vmstat -a

ipcs -sm

ipcs -lms

sar -n DEV | more

sar 4 5

mpstat -P ALL

MEMORY intensive process:

ps -e -o pmem,pid,user,tty,args | grep -i oracle | sort -n -k 1 -r | head

watch -n 3 -d free

watch -d cat /proc/meminfo

CPU intensive process

top

ps -e -o pcpu,pid,user,tty,args | sort -n -k 1 -r | head

mpstat -P 0 2 20 (processor 0

mpstat -P ALL

sar -u -f

Disk Storage
************************************

iostat -d 3, iostat 2 15

iostat -xd 10


sorting files by size
***********************

ls -alS | head -5

mpstat -P ALL

sar 4 5

****************************************************
Network
**************************************************

lsmod | grep -i bonding

cat /etc/sysconfig/network-scripts/ifcfg-eth0 (check bonding)..the difference NETWORK, IPADDRESS, NETMASK

netstat -s | less

netstat --interfaces eth0

netstat -ptc

sar -n DEV

netstat -nat | awk '{ print $5}' | cut -d: -f1 | sed -e '/^$/d' | uniq

tcpdump -n -i eth1 -s 0 -w output.txt src or dst port 80

iptraf - Real-time Network Statistics

Network traffic

netstat -ptc

sar -n DEV

sar - Collect and Report System Activity

*************************************************
Oracle
***************************************************

cpio -idmv < 10201_database_linux_x86_64.cpio

id oracle

id nobody

pgrep sshd

env | grep PATH

detected hardware lshal:

init process determines which runlevel it should be /etc/inittab

shutdown

shutdown -t3 -r now

mount /dev/hda4 /data/oracle/bkup1:

 grep ‘Ashley Nguyen’ /etc/passwd

find / -name install.log

sed ‘s/anguyen/lvu/’ /etc/passwd > /tmp/test

ps aux | grep nfs

free:

Ifconfig -a

To determine the amount of shared memory available, enter the following command:automatic memory management


# df -k /dev/shm/

To determine the distribution and version of Linux installed, enter the following command:

# cat /proc/version

To determine whether the required packages are installed, enter commands similar to the following:

# rpm -q package_name

Add group

# /usr/sbin/groupadd oper

Modify user:  usermod -g oinstall -G dba oracle

Create disks:

fdisk -l

give password to oracle user

passwd oracle

change ownership in linux

chown

clear screen

clear

TAR - backup / restore

tar -cf myfiles.tar *.trc (create)

tar xvf myfiles.tar (extract)

tar tvf myfiles.tar (show the details)

Wednesday, August 15, 2012

what is Work Managers in Weblogic Server?

Work Managers:

WebLogic Server is self-tuning in nature by default, that is, it adjusts the thread size as needed.
WebLogic Server uses a single thread pool whose size changes automatically to maximize throughput. This process is called server self-tuning. The queue monitors throughput over time and based on history and determines whether to adjust the thread count. The server increases or decreases pool size if a higher or lower thread count increases performance. All the work is executed within this pool.
WebLogic Server prioritizes work based on rules defined by an administrator and run-time metrics, including the actual time it takes to execute a request and the rate at which requests are entering and leaving the pool. This new strategy makes it easier for administrators to allocate processing resources and manage performance, avoiding the effort and complexity involved in configuring, monitoring, and tuning custom executes queues.

Default Work Manager:

•  All applications are given equal priority.
•  A default fair share of threads is given to each application.
•  If no Work Manager is explicitly assigned to an application, it uses the default Work Manager.
•  The default Work Manager can be overridden by creating and configuring a global Work Manager called default.
Work Manager Scheduling Guidelines:
•  Use when the default fair share is insufficient.
•  Use to schedule work based on application priority.
•  Use when applications require different response times.
•  Use to avoid server deadlocks.

Components of Work Manager:

–  Request Classes.
–  Constraints.
Request Classes:
Request classes help schedule work based on priority.
Three types of request classes:
•  fair-share-request-class
•  response-time-request-class
•  context-request-class
Fair Share Request Class:
The fair share request class specifies the average percentage of thread-use time required to process requests.
•  Configuration options: Name and Fair share value
•  Default value: 50
•  Minimum value: 1
•  Maximum value: 1000
Fair Share Request Class
The fair share request class specifies the average percentage of thread-use time required to process requests.
Snippet: high priority fair share request class
fair-share-request-class>
<name>high_priority</name>
<fair-share>90</fair-share>
</fair-share-request-class>

Snippet: low priority fair share request class
<fair-share-request-class>
<name>low_priority</name>
<fair-share>10</fair-share>
</fair-share-request-class>

Response Time Request Class:
The response time request class specifies a response time goal in milliseconds.
•  Configuration options: Name and Goal (milliseconds)
•  Default value: 0
Snippet: fast response request class <ModuleA>
<response-time-request-class>
<name>fast_response_time</name>
<goal-ms>1000</goal-ms>
</response-time-request-class>
Snippet: slow response request class <ModuleB>
<response-time-request-class>
<name>slow_response_time</name>
<goal-ms>8000</goal-ms>
</response-time-request-class>
Context Request Class:
The context request class assigns request classes to requests based on context information, such as the current user or the current user’s group.
•Configuration options: Name and context case
Snippet: context request class
<context-request-class>
<name>simple_context</name>
<context-case>
<user-name>system</user-name>
<request-class-name>high_fairshare</request-class-name>
</context-case>
<context-case>
<group-name>everyone</group-name>
<request-class-name>low_fairshare</request-class-name>
</context-case>
</context-request-class>
Constraints:
•  A constraint defines:
–  The minimum and maximum numbers of threads allocated to execute requests
–  The total number of requests that can be queued or executing before WebLogic Server begins rejecting requests
• Types of constraints:
–  max-threads-constraint
–  min-threads-constraint
–  capacity.
Maximum Threads Constraints:
The maximum threads constraint limits the number of concurrent threads that can execute requests sharing this constraint.
Configuration options:
–  Name: The user-specified name
–  Count: Thread count (Default value: -1)
– Data Source: The name of the connection pool whose size is taken as the maximum constraint
Snippet: maximum threads constraint
<max-threads-constraint>
<name>max_threads</name>
<count>10</count>
<connection-pool-name></connection-pool-name>
</max-threads-constraint>
Minimum Threads Constraints:
The minimum threads constraint guarantees a minimum number of concurrent threads that the server allocates to requests sharing this constraint.
Configuration options:
–  Name: The user-specified name.
–  Count: Thread count (Default value: -1)
Snippet: minimum threads constraint
<min-threads-constraint>
<name>min_threads</name>
<count>1</count>
</min-threads-constraint>
Capacity Constraints:
The capacity constraint causes the server to reject requests only when it has reached its capacity to avoid server deadlocks.
Configuration options:
–  Name: The user-specified name
–  Count: Thread count (Default value: -1)
Snippet: capacity constraint
<capacity-constraint>
<name>my_capacity</name>
<count>50</count>
</capacity-constraint>
Referencing Classes or Constraints:
A Work Manager is defined by encapsulating one request class and/or one constraint to schedule requests.
Configuration options:
–  Name and request class/constraint
Snippet: Work Manager
<work-manager>
<name>priority_work_manager</name>
<fair-share-request-class>
<name>very_high_priority</name>
<fair-share>1000</fair-share>
</fair-share-request-class>
<min-threads-constraint>
<name>min_five_Threads</name>
<count>5</count>
<min-threads-constraint>
</work-manager>

How to Create and configuring Work Managers in WebLogic?

A Work Manager defines a set of request classes and thread constraints that manage work performed by WebLogic Servers. This page displays the global Work Managers, request classes and thread constraints defined for this domain.
Global Work Managers are defined at the domain level. You can also define application-level and module-level Work Managers.

Create a Global Work Manager

Using the Administration Console, you can create global work managers that are used to prioritize thread execution.
Note: You cannot create or configure app-scoped Work Managers using the Administration Console.
Follow these steps to create a global Work Manager:
1). If you have not already done so, in the Change Center of the Administration Console, click Lock & Edit
2). In the Administration Console, expand Environment and select Work Managers.
3). Click New.
4). Select the Work Manager button, then click Next.
5). Enter a name for the new Work Manager.
6). Click Finish.
7). To activate these changes, in the Change Center of the Administration Console, click Activate Changes.
Not all changes take effect immediately—some require a restart
After you finish
After you have created a global Work Manager, you must create at least one request class or constraint. The global Work Manager uses request classes and constraints to determine how to priortize work.

Create a Global Request Class

To create a global request class:
1). If you have not already done so, in the Change Center of the Administration Console, click Lock & Edit
2). In the Administration Console, expand Environment and select Work Managers.
3). Click New.
4). Select the button next to the type of global request class you want to create.
5). Click Next.
6). Input the configuration information based upon the type of request class you are creating.
7). Click Finish.
8). To activate these changes, in the Change Center of the Administration Console, click Activate Changes.
Not all changes take effect immediately—some require a restart
Result
The new constraint appears in the Global Work Managers, Request Classes and Constraints table.
After you finish
After you have created a request class, you must assign it to a Work Manager in order to use it. Each Work Manager can contain only one request class of each type, but you can share request classes among multiple Work Managers.

Create a Global Constraint

To create a global constraint:
1). If you have not already done so, in the Change Center of the Administration Console, click Lock & Edit
2). In the Administration Console, expand Environment and select Work Managers.
3). Click New.
4). Select the button next to the type of global constraint you want to create.
5). Click Next.
6). Input the configuration information based upon the type of constraint you are creating.
7). Click Finish.
8). To activate these changes, in the Change Center of the Administration Console, click Activate Changes.
Not all changes take effect immediately—some require a restart
Result
The new constraint appears in the Global Work Managers, Request Classes and Constraints table.
After you finish
After you have created a constraint, you must assign it to a Work Manager in order to use it. Each Work Manager can contain only one constraint of each type, but you can share constraints among multiple Work Managers.

Delete a Global Work Manager, Constraint, or Request Class

To delete a global Work Manager:
1). If you have not already done so, in the Change Center of the Administration Console, click Lock & Edit
2). In the Administration Console, expand Environment and select Work Managers.
3). Select the check box next to the Work Manager, request class, or constraint you want to delete.
4). Click Yes to confirm that you want to delete the selected item.
5). To activate these changes, in the Change Center of the Administration Console, click
ActivateChanges.
Not all changes take effect immediately—some require a restart

Solution for Unable To Start Admin Server with Error BEA-000386

Symptoms
After an outage or unexpected physical machine shutdown weblogic does not start.
If you see this error when admin server is starting, or the following exception is thrown:
<Critical><BEA-000386> <Server subsystem failed. Reason: java.lang.AssertionError: java.lang.reflect.InvocationTargetException
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
at weblogic.descriptor.DescriptorManager$SecurityServiceImpl$SecurityProxy._invokeServiceMethod(DescriptorManager.java:175)
…
Changes
No changes, in particuluar. Possibly a physical machine shutdown or outage.
Reason:
The file SerializedSystemIni.dat has become corrupted. This file contains the hash to decrypt the encrypted credential values if the config.xml. So, the Admin Server will not start because is not able to decrypt the credential and perform authentication properly.
ReSolution:
The corrupted hash values must be replaced.
1. Edit all the encrypted values in the config.xml to plain text.
Example:
Before:
<credential-encrypted>{AES}b3I7UhWtRyj4DuKMIDVtW4Ln2nzH+HiYRhhQw1H2qpU0qJMOaDlK8iFZ+LvlJu+i
Zs6pptFJgWz8ryyudL1Zyvf00Rg11z9Iib7hoDC8covMFuig8wx7iOGK88zeKH7U</credential-encrypted>
After:
<credential-encrypted>MyCredentialInPlainText</credential-encrypted>
2. Restart the Admin Server.
After restart the Admin Server, the credentials will be encrypted again and the AdminServer will start.

What are the Deployment tips in Weblogic server?

WebLogic Server allows you to store deployment units either as a single archive file, or as an exploded directory that contains the same contents of the archive file.

An archive file is a single file that contains all of an application’s or module’s classes, static files, directories, and deployment descriptor files.

Deploy user applications on managed server instances. This separates the administration application (console) and the domain configurations from user applications.

Avoid using automatic deployment of applications in production and multiple-server environments. Running the WebLogic domain in “Production Mode” will disable the automatic deployment in production. If you create scripts for deploying applications as a part of an overall build, consider using the wldeploy Ant task.

If you deploy an application (or module) with the On Future Redeploys option set to Ignore Roles and Policies From DD one or more times before setting it to Initialize Roles and Policies From DD, you can set security policies and security roles using the admin console. But these changes using admin console will override security specified in deployment descriptors.

Tips:

    Use production mode to run production applications.

    Avoid deploying user applications on admin server instance.

    To specify the server’s default Web application, use an empty context-root element or an element with a value “/” in the weblogic.xml or application.xml file.

    Changing security policies for an application after deployment in the admin console overrides the policies in the deployment descriptor.

Redeployment:

Once you deploy an application, you can redeploy the application itself or selected parts of the application. Redeploying an entire application involves unloading all its classes and then deploying the application again with the changed files. Redeploying an application in production is a serious undertaking that can affect performance, so plan application updates carefully.

If a Web application is in production and in use, redeploying causes WebLogic Server to lose all active HTTP sessions. HTTP session can be restore by turning a special property ON in the WebLogic specific deployment descriptor file (weblogic.xml).

Tips:

    If you have modified only static files, it is possible to refresh them without redeploying the entire application.

    Use command-line option to partially redeploy an expanded application (weblogic.Deployer … -redeploy …).

    For changing deployment parameters without changing the application, use alternate deployment descriptors.

    To simplify re-distributing application archives to multiple WebLogic Server instances during redeployment use stage mode deployment.

    A managed server with all application staged can be started and be made fully functional in independence mode if admin server is not available.

Enterprise Application:

WebLogic optimizes EJB access, if the client is within the same enterprise application classes and libraries can be shared across all archive applications within the enterprise application. So consider creating enterprise archives rather than deploying related applications independently.

Also Enterprise-wide settings can be used, rather than multiple local settings in deployment descriptors. Create JDBC resources in the WebLogic Server domain, using the WebLogic console, rather than employing the weblogic-application.xml technique.

Tips:

    Avoid deploying EJB archives and related Web applications as separate independent applications in WebLogic Server.

    Improved runtime performance can be achieved when Web components access EJB components within the same enterprise application.

    The enterprise can be deployed as one deployment unit.

    Do not place application-specific classes or JAR files in the system classpath (to avoid having to restart the server for reloading them).

    When using WebLogic Server 8.1, use the new APP-INF/lib and APP-INF/classes directories in the enterprise-application directory structure, to simplify the packaging of utility classes and utility archives.

Pre-compilation:

Production and test deployments should include precompiled JSP pages and EJBs (use weblogic.appc or weblogic.jspc/weblogic.ejbc with earlier weblogic versions). They can catch compile-time errors in applications long before you deploy them. Also offline compilation validates the deployment descriptors for compliance with current specifications.

Deploying compiled applications reduces deployment time and subsequent server restart time. Development deployments intended for use on the developer’s workstation can use on-the-fly compilation.

Tips:

    To precompile JSP files during application deployment or server startup, enable the precompile parameter in weblogic.jar.

    To disable pagecheck and recompilation at runtime in a production environment, set pageCheckSeconds to -1.

    You can use weblogic.appc or weblogic.ejbc (deprecated) to compile EJBs outside the server VM. This reduces the subsequent server restart time.

    Use the weblogic.Deployer utility, or its associated Ant task, wldeploy, in scripts to automate deployment in production environments.

Deployment Descriptor Editing:

Changing the deployment descriptor of a J2EE application takes effect only when the application is redeployed. The WebLogic admin console provides a way to change some deployment descriptor attributes without redeploying the application. To take advantage of this feature, you must to deploy the application in exploded directory structure (non-archived format), when the domain is running in development mode.

To change descriptor values of the application after deployment (as exploded format) go to Web Application Module > Your Application > Configuration tab > Descriptor tab.

Tips:

    Use tools provided with WebLogic Server to generate and edit XML deployment descriptors.

    WebLogic Builder generates descriptors; it includes an interface for editing descriptors.

    DDInit is a command-line utility for generating deployment descriptors for WebLogic Server applications.

    ddcreate is an Ant task that can be used for creating deployment descriptors for enterprise applications.

EJB:

A stateless session EJB free pool improves performance and throughput as beans are created at server startup or deployment time. WebLogic Server uses a cache of bean instances to improve the performance of stateful session EJBs. The cache stores active EJB instances in memory so that they are immediately available for client requests.

Using application-level/combined cache will result in reduced fragmentation, better utilization of memory and heap space. But the use of application-level/combined cache is limited to entity EJBs in an enterprise application. For an application that requires high throughput, use bean-level caching. Bean-level caching is effective because tasks do not compete for control of the one thread of control in a combined cache.

To make use of WebLogic provided optimization of calls made to EJB components within an application, set to true.

The same can also be achieved by writing local interfaces for EJBs for access within the same enterprise application.

Concurrency strategies for entity EJBs include:

Database:

Improves throughput by deferring to database (for EJB 1.1 and 2.0, this is the default and recommended mechanism)

Exclusive:

Avoids deadlocks; use it only if a high level of consistency is required on non-clustered servers

Optimistic:

No lock will be held in the EJB container or database during transaction. But the EJB container ensures that the data being updated by a transaction has not been changed.

Read-only:

Container does not attempt to save a bean’s state at the end of a transaction; use this for EJBs that do not make any change to persistent data. With the read-only strategy, use to invalidate cached bean data in the container; this updates the data from the persistent store when a timeout occurs.

Tips:

    Consider the number of execute threads, to configure maximum number of beans in the free pool.

    To limit the memory used by a stateful session EJB, set the maximum number of beans that can reside in the cache (max-beans-in-cache).

    Too small cache causes frequent activation and passivation.

    Too large a cache wastes memory.

    LRU algorithm keeps a bean in the passive state after it passes the ideal number timeout seconds.

    To avoid the associated overhead of passivating stateful session EJBs, use the not recently used (NRU) algorithm

    Local interfaces for EJBs provide optimized access for server-side EJB clients.

    Combined cache enables the administrator to tune just one cache, rather than multiple caches, in weblogic-application.xml.

    Message-driven beans that use container-managed transactions must use XA connection factories.

Friday, July 6, 2012

Weblogic Interview Questions & Answers

Q: - How do I increase WebLogic Server memory?

Increase the allocation of Java heap memory for WebLogic Server. (Set the minimum and the maximum to the same size.) Start WebLogic Server with the -ms32m option to increase the allocation, as in this example:

$ java ... -ms32m -mx32m ...

This allocates 32 megabytes of Java heap memory to WebLogic Server, which improves performance and allows WebLogic Server to handle more simultaneous connections. You can increase this value if necessary.


Q: - Can I configure the messaging bridge to automatically downgrade the quality of service if the Exactly-once service isn't available on either the source or target bridge destination?

Yes, just make sure to select the QOS Degradation Allowed check box on the Messaging Bridge > Configuration > General administration console page.


Q: - How do I restrict access to servlets and JSPs?

The Java Servlet API Specification v2.2 allows you to declaratively restrict access to specific Servlets and JSPs using the Web Application Deployment descriptor. Section 13.3.2 of the specification has an example deployment descriptor that uses declarative security. For more information, see Programming WebLogic HTTP Servlets.



Q: - Can I start a Managed Server if the Administration Server is unavailable?


By default, if a Managed Server is unable to connect to the specified Administration Server during startup, it can retrieve its configuration by reading a configuration file and other files directly. You cannot change the server's configuration until the Administration Server is available. A Managed Server that starts in this way is running in Maindexindex1naged Server Independence mode.






Q: - How do I increase WebLogic Server memory?

Increase the allocation of Java heap memory for WebLogic Server. (Set the minimum and the maximum to the same size.) Start WebLogic Server with the -ms32m option to increase the allocation, as in this example:

$ java ... -ms32m -mx32m ...

This allocates 32 megabytes of Java heap memory to WebLogic Server, which improves performance and allows WebLogic Server to handle more simultaneous connections. You can increase this value if necessary.



Q: - Can I start a Managed Server if the Administration Server is unavailable?

By default, if a Managed Server is unable to connect to the specified Administration Server during startup, it can retrieve its configuration by reading a configuration file and other files directly. You cannot change the server's configuration until the Administration Server is available. A Managed Server that starts in this way is running in Maindexindex1naged Server Independence mode.



Q: - How are notifications made when a server is added to a cluster?

The WebLogic Server cluster broadcasts the availability of a new server instance each time a new instance joins the cluster. Cluster-aware stubs also periodically update their list of available server instances.


Q: - What happens when a failure occurs and the stub cannot connect to a WebLogic Server instance?


When the failure occurs, the stub removes the failed server instance from its list. If there are no servers left in its list, the stub uses DNS again to find a running server and obtain a current list of running instances. Also, the stub periodically refreshes its list of available server instances in the cluster; this allows the stub to take advantage of new servers as they are added to the cluster.



Q: - Can I enable requests to a JDBC connection pool for a database connection to wait until a connection is available?

No, there's no way to allow a request to wait for a pool connection, and from the system point of view there should not be. Each requests that waits for a connection ties up one of the fixed number of execute threads in the server, which could otherwise be running another server task. Too many waiting requests could tie up all of the execute threads and freeze the server.



Q: - How do I use multibyte character sets with WebLogic jDriver for Informix?

Currently, multibyte character sets are not supported for the WebLogic jDriver for Informix driver.

Tuesday, July 3, 2012

Application server definition ?

An application server is a component-based product that resides in the middle-tier of a server centric architecture. It provides middleware services for security and state maintenance, along with data access and persistence.
Java application servers are based on the Java™ 2 Platform, Enterprise Edition (J2EE™). J2EE uses a multi-tier distributed model. This model generally includes a Client Tier, a Middle Tier, and an EIS Tier. The Client Tier can be one or more applications or browsers. The J2EE Platform is in the Middle Tier and consists of a Web Server and an EJB Server. (These servers are also called "containers.") There can be additional sub-tiers in the middle tier. The Enterprise Information System (EIS) tier has the existing applications, files, and databases.
For the storage of business data, the J2EE platform requires a database that is accessible through the JDBC, SQLJ, or JDO API. The database may be accessible from web components, enterprise beans, and application client components. The database need not be accessible from applets.
See the related content links below for more information.
J2EE multi-tier architecture showing the client tier, middle tier, and EIS tier

what are the Best Practices for WebLogic Environment?

1. Dedicated Users per installation
Oracle WebLogic installation on Solaris machine or Linux or a Windows machine better to have a dedicated user where you can install the WebLogic components. provide access to all other users so that no need of reinstalling required for each new domain on the same machine.


  1. useradd [options] LOGIN  
  2.   
  3. Some of important options are:  
  4.   
  5. -d home directory  
  6. -s starting program (shell)  
  7. -p password  
  8. -g (primary group assigned to the users)  
  9. -G (Other groups the user belongs to)  
  10. -m (Create the user's home directory  

  1. useradd -g wladev -G wladmin -s /bin/bash -p xxxxxxxx -d /home/user -m user  
Remember that, You can run this command if you have root user access only

2. Using of sed
When I worked for WebLogic 9.2 migration for each instance wise configuring fresh properties updating took me around a week time for whole environment. This time WebLogic 11g migration I have an idea to use stream editing option, and apply proper regular expressions to finish my task. It worked for me awesome, whole updating done in half hour with small script that included sed in a for loop. I had to change multiple lines search and replace in multiple files in the same machine, so I took the above said trick it worked and saved my time.


  1. for i in `ls instances|grep c`  
  2. do  
  3. cd $INST_HOME/$i/config  
  4. cp /oldinstance/$i/config/*.properties .  
  5. sed -e "s/$i-//g" \  
  6.       -e "s/$i\_//g" \  
  7.       -e "s/\_$i//g" \  
  8.       -e "s/-$i//g" \  
  9.       -e "s/wluser92/wluser11/g"  &lt;  log4j.properties  &gt;temp  
  10. mv temp log4j.properties  


User per domain: If you are preparing a development environment then you can choose a user per domain it is the best way to avoid conflicts between developers code changes etc. Install new Oracle License and keep always a backup of old License.

3. Customizing your domain

AdminServer name, ListenAddress, ListenPort, Some times you might see errors saying that "Listen Port already in use", To avoiding port conflicts: Before assigning a port to your WebLogic instance better you check whether it is already in use or not? by using netstat command.
About Virtual IP issues.

i) WebLogic Server wise logs generation

WebLogic Server instance each one can generate separate server side logs as well as application logs. Most of the developers while troubleshooting an issue they must know from which server it was happening for this log4j provides more flexibility to digg/debug every Java package, class level, even method, line level too.

How to collect it?
To make this possible you need to enable your WebLogic server library path must pick the log4j-1.2.8.jar and the logging definitions in a separate file lets say it as log4j.properties file.

Where to set?
Before weblogic.jar path or after? Oracle recommands application related jars and third-party jars must be set after weblogic.jar.

ii) Editing for all Domain Environments
Editing common scripts impacts all the domains in that machine. If there is a need for the WebLogic server run with server JVM that will give more scope for In commEnv.sh script we are going to update .
Sample Example:

  1. 191    Sun)  
  2. 192      JAVA_VM=-client  
  3. change to  
  4. 191    Sun)  
  5. 192      JAVA_VM=-server  
4. Scalability for Domain
Adding servers to  or removing servers existing Cluster is nothing but scalability. While defining new Cluster identify proper multi-cast address suitable to your environment with multi-cast test. You must use Interface Address as the DNS/IP of the machine where the instance is configured in each server's Cluster tab. This will make you easy to run the clustered environment.

5. Effort saving means cost saving
While preparing your configuration keep focus on portable coding. I have been to many UNIX forums to find portable and flexible scripting. Here I am sharing for you. Efforts can be focused on the following things

i. Customized start script for admin server,
ii. Customized start script for managed server
The following start script save it as "startMserver.sh" assuming that you might need few instance specific properties need to refer in startWebLogic.sh script.

  1. INSTANCE=$1  
  2. export INSTANCE  
  3. SOURCE=$(cd -P -- "$(dirname -- "$0")" && pwd -P)  
  4. cp $INST_HOME/$INSTANCE/logs/$INSTANCE.out $INST_HOME/$INSTANCE/logs/$INSTANCE.out.bkp  
  5. nohup $SOURCE/startManagedWebLogic.sh $INSTANCE &gt;$INST_HOME/$INSTANCE/logs/$INSTANCE.out 2&gt;&1 &  
  6. echo tail -f $INST_HOME/$INSTANCE/logs/$INSTANCE.out  

Here $INST_HOME is defined in the user profile script.

These customized start scripts for admin server and managed servers. In the script make a copy of the last server instance log to instance.out_bkp. Some times due to some panic situations servers might crashed, after monitoring you found that it happen so restarting server should not loss that lost logs. If you maintain the backup of logs file automatically before starting the instance, then you are saved with that backup log file for further analysis about that crash.

Here in the above script, Most of the UNIX environments your script could use "nohup" that means no hung up when the remote machine is accessed with ssh/Putty.
If you create this script in development/QA environment same script can be used for production because keeping it more portable with SDIR (source directory path).

iii. Customized Stop All script for each domain 
Best option I found from stopManagedWebLogic.sh given by the Oracle. It is normal shell script it will invokes the Python script on the fly. I just replaced the 'Server' with 'Cluster' argument for shutdown WLST command and also called admin stop script in the bottom.



  1. #!/bin/sh  
  2.   
  3. DOMAIN_HOME="/home/domains/mydomain"  
  4.   
  5. . ${DOMAIN_HOME}/bin/setDomainEnv.sh  
  6. ADMIN_URL="t3://my.adminhost.com:adminPort"  
  7.   
  8. echo "wlsUserID ='username'" &gt;&gt;"shutdown.py"   
  9. echo "wlsPassword = 'password'" &gt;&gt;"shutdown.py"   
  10. echo "connect(${wlsuserID}, ${wlsPassword}, url='${ADMIN_URL}')" &gt;&gt;"shutdown.py"   
  11.    
  12. #=== fetching cluster list from the domain configuration repository =============  
  13. for cl in `grep -i clstr\&lt;\/n ../config/config.xml|sed  's/.*<name>\(.*\)&lt;\/name&gt;.*/\1/'  
  14. do  
  15.  echo "shutdown($cl','Cluster')" &gt;&gt;"shutdown.py"   
  16.  echo "state($cl)"&gt;&gt;"shutdown.py"   
  17. done  
  18. echo "shutdown()" &gt;&gt;"shutdown.py"   
  19. echo "exit()" &gt;&gt;"shutdown.py"   
  20.    
  21. echo "Stopping Weblogic Server..."  
  22. java -classpath ${FMWCONFIG_CLASSPATH} ${MEM_ARGS} ${JVM_D64} ${JAVA_OPTIONS} weblogic.WLST shutdown.py  2&gt;&1   
  23.   
  24. echo "Done"  
  25. </name>  

iv. Server Health checking script
Separate is a time, effort saving

6. Deployment Strategies
System resource deployments better you prepare your customized JDBC Data source configuration script using WLST. Avoid Start-up Classes configuration which will make dependable deployment, which leads you to not able to use side-by-side(SBS) deployment advantage.

7. WebLogic 9.x onwards You have a flexibility to use Deployment plans for UAT, QA, Staging environments as same as production. This will reduce the problem of porting the code on one environment to other without any configuration changes.

8. OOME
Most of the production environments first hurdle is OOME, if it is occurring in your Web-tier environment then you can use JSP pre-compile.Prepare GC monitoring scripts

9. Now a days everywhere you can find Virtualization (SOLARIS ZONES), Cloud computing, Clustering (Database RAC), Grid concepts, Veritas Clustering in Disks/RAID etc. Have each topic in breif knowledge that could make you understand if anything goes wrong somewhere in the application environment you can easily figure it out.

10. Know about your production environment end to end how the data flows? Firewall, Load balancer software or hardware, proxy-plugin security aspects, Network connectivity, Net-backup locations etc.

How to Clearing Cache for WebLogic instance?

What is actually WebLogic Cache?
Basically all the web-tier related files (.jsp .class, JSPCompiled files etc.,) get stored in ./wlnotdelete/app_yourapplicaiton directory. This is treated as cache whenever there is restart of a WebLogic instance happen then the WebLogic server will look-up for last serviced object status stored in the cache to service for any pending requests. Usually, when your EJB Classes need sessions, JMS object requires persistance, your web-tier may contain static contents then Cache will be used by WebLogic Application Server instance.

Why we need to remove Cache?
Whenever your application is accessed for the first time that fresh deployment of a new version, WebLogic server lookup in this directory, if there are older objects persists that will be conflict with new code objects. This is where the need of removal of cache arises.

Where there is a need of new version deployment we might need to clear the cache when the changes to the new version is not reflected. In the old version WebLogic 8.1 below we used to remove .wldonotdelete folder. In new version of WebLogic 9.x onwards removal of cache means deleting each server instance's tmp folder contains cache, stage folders or you can simply remove tmp folder too provided there should not be configuration changes happen to the server.

Generally for WebLogic 9.x and higher versions
WIN: C:\bea\user_projects\domains\yourdomain\servers\yourserver\tmp
UNIX: /bea/user_projects/domains/yourdomain/servers/yourserver/tmp

you can use the following commands to clear the cache:
WIN: rd C:\bea\user_projects\domains\yourdomain\servers\yourserver\tmp \s
UNIX: rm -rf /bea/user_projects/domains/yourdomain/servers\yourserver/tmp

Here I am removing all the subdirectories and files in the the given directory.

When to do this?
After Stopping the WebLogic server instance you can go for removal of cache.
Mostly, Spring framework users, struts framework users have this no changes reflected issue for their web applications.

Alternative solution is you can use 'stage' mode set to 'no_stage' deployment. when undeployed an applicaiton then WebLogic server itself removes the cache objects.

Sunday, July 1, 2012

Difference between Application Server and Web Server in Java ?

Application server and web server in Java both are used to host Java web application. Though both application server and web server are generic terms, difference between application server and web server is a famous J2EE interview question. On  Java J2EE perspective main difference between web server and application server is support of EJB. In order to run EJB or host enterprise Java application (.ear) file you need an application server like JBoss, WebLogic, WebSphere or Glassfish, while you can still run your servlet and JSP or java web application (.war) file inside any web server like Tomcat or Jetty.


Application Server vs Web Server


1. Application Server supports distributed transaction and EJB. While Web Server only supports Servlets and JSP.
2. Application Server can contain web server in them. most of App server e.g. JBoss or WAS has Servlet and JSP container.

3. Though its not limited to Application Server but they used to provide services like Connection pooling, Transaction management, messaging, clustering, load balancing and persistence. Now Apache tomcat also provides connection pooling.

4. In terms of logical difference between web server and application server. web server is supposed to provide http protocol level service while application server provides support to web service and expose business level service e.g. EJB.

5. Application server are more heavy than web server in terms of resource utilization.

Personally I don't like to ask questions like Difference between Application Server and Web Server. But since its been asked in many companies, you got to be familiar with some differences. Some times different interviewer expect different answer but I guess on Java's perspective until you are sure when do you need an application server and when you need a web server, you are good to go.