Taking Weblogic Thread Dumps
Taking Weblogic Thread Dumps
Thread Dump will be printed to the servers standard out (by default, the shell in which the server
is running)
On Windows machine:
cltr + break
On Unix Machine:
get pid using ps -ef grep java
kill -3 (process id)
When weblogic is running as windows service
For Out file add in JAVA_OPTIONS:
-Dweblogic.Stdout=
Using beasvc :
beasvc dump svcname:bea Admin_server
Using Weblogic Admin utility
C:\bea\user_projects\domains\rDomain>java weblogic.Admin -url t3://localhost:7001
-username weblogic -password weblogic THREAD_DUMP
Collecting thread dumps from the console:
Server > Monitoring > Threads > Dump Thread Stacks
Using WLST:
java weblogic.WLST
connect("weblogic","weblogic","t3:\\localhost:7001")
threadDump()
#
# Takes an argument (PID of the WLS process) and loops three times.
# This will append the prstat information to a file called dump_high_cpu.txt.
# The thread dump information will either be in file where stdout was redirected or
printed on the screen.
#
if test $# -eq 0
then
echo "usage: $0 <processID>";
else
for loopnum in 1 2 3
do
echo `date`
CURDATIME=`date '+%y%m%d_%H%M%S'`
echo $CURDATIME
prstat -L -p $1 1 1 >> ~/export/home/username/`hostname`_$
{CURDATIME}_$1.out
pstack $1 >> ~/export/home/username/`hostname`_$
{CURDATIME}_$1.out
kill -3 $1
echo "prstat, pstack, and thread dump done. #" $loopnum
sleep 1
echo "Done sleeping."
done
fi
Nodemanager
Nodemanager is used to remotely start, stop and restart weblogic managed servers
remotely.
Nodemanager configuration:
nodemanager.properties is created in the directory where you start Node Manager the first time
you start Node Manager after installation of WebLogic Server. Each time you start Node
Manager, it looks for nodemanager.properties in the current directory, and creates the file if it
does not exist in that directory.
Start the nodemanager using startNodeManager.cmd (sh) in your server/bin directory.
Configure machines and fill in the server start tab in the Admin console with necessary
information.
Now you can remotely start and stop servers using Admin console/WLST
When we start manager it give all the configuration information on the screen as below:
Configuration settings:
NodeManagerHome=D:\bea\WLSERV~1.3\common\NODEMA~1
ListenAddress=
ListenPort=5556
ListenBacklog=50
SecureListener=true
AuthenticationEnabled=true
NativeVersionEnabled=true
CrashRecoveryEnabled=false
JavaHome=d:\bea\JROCKI~2\jre
StartScriptEnabled=false
StopScriptEnabled=false
StartScriptName=startWebLogic.cmd
StopScriptName=
LogFile=D:\bea\WLSERV~1.3\common\NODEMA~1\nodemanager.log
LogLevel=INFO
LogLimit=0
LogCount=1
LogAppend=true
LogToStderr=true
LogFormatter=weblogic.nodemanager.server.LogFormatter
DomainsFile=D:\bea\WLSERV~1.3\common\NODEMA~1\nodemanager.domains
DomainsFileEnabled=true
StateCheckInterval=500
Domain name mappings:
wl_server -> D:\bea\wlserver_10.3\samples\domains\wl_server
lab -> d:\bea\user_projects\domains\lab
medrec -> D:\bea\wlserver_10.3\samples\domains\medrec
Under data/nodemanager (Example,
C:\bea\user_projects\domains\new_domain\servers\new_ManagedServer_1\data\nodemanager)
we can see startup.properties file for nodemanager. The boot.properties file is also copied here.
The nm_password.properties is located under Domain_Home\config\nodemanager
Under the monitoring tab of each machine, we can check if node manager is reachable of not.
Else we can enroll nodemanager and this copies all security information to each managed server.
Also file called new_ManagedServer_1.state,.lck, .pid etc., are created under the
data/nodemanager of each managed server.
Summary:
nodemanager.properties
This is the configuration file used by the Java-based version of Node Manager.
This file is located in WL_HOME/common/nodemanager.
nodemanager.hosts
This file contains a list of all the trusted hosts that can issue commands to Node Manager.
This file is located in WL_HOME/common/nodemanager.
nodemanager.domains
This file contains mappings between the names of domains managed by Node Manager and their
corresponding directories.
This file is located in WL_HOME/common/nodemanager.
nm_data.properties
This file stores the encryption data the Node Manager uses a symmetric encryption key. The data
is stored in encrypted form.
This file is located in WL_HOME/common/nodemanager.
nm_password.properties
This file stores a username/password pair specific to the Node Manager server that is managing
this domain. This is known as the Node Manager secret. The username and password are
appended to a salt value (obtained from the SerializedSystemIni.dat of the domain) and SHAhashed.
This file is located in DOMAIN_HOME/config/nodemanager.
boot.properties
Node Manager uses this file to specify a boot identity when starting a server. This file is located
in domain-name/servers/server_name/data/nodemanager.
startup.properties
Each Managed Server instance has its own startup.properties file with properties that control how
Node Manager starts up and controls the server. Node Manager automatically creates this file by
using properties passed to Node Manager when the Administrative Server was last used to start
the server. This allows a Node Manager client or startup scripts to restart a Managed Server using
the same properties last used by the Administrative Server.
These properties correspond to the server startup attributes contained in ServerStartMBean and
the health monitoring attributes in ServerStartMBean.
This file is located in domain-name/servers/server_name/data/nodemanager.
server_name.addr
server_name.addr stores the IP address added when a server starts or is migrated. This file is
generated after the server IP address is successfully brought online during migration.
server_name.addr is deleted when the IP address is brought offline. The server IP address is used
to validate remove requests to prevent addresses being erroneously removed while shutting down
the server.
This file is located in domain-name/servers/server_name/data/nodemanager.
server_name.lck
server_name.lck is generated by each server and contains an internally used lock ID.
This file is located in domain-name/servers/server_name/data/nodemanager
server_name.pid
server_name.pid is generated by each server and contains the process ID of the server. Node
Manager checks the process ID generated by the server during crash recovery.
This file is located in domain-name/servers/server_name/data/nodemanager
server_name.state
server_name.state is generated by the server and contains the server's current state. Node
Manager monitors the contents of this file to determine the current state of the server.
Note: Do not delete or alter this file. Without this file Node Manager cannot determine the
current state of the server.
The nm_password.properties file contains the Node Manager username and password. These are
used to authenticate connection between a client (for example, the Administration Server) and
Node Manager. This username and password are only used to authenticate connections between
Node Manager and clients.
The nodemanager.domains file specifies the domains that a Node Manager instance controls.
When we add new machine to a node manager we need to use the following command to register
the node manager.
nmEnroll('C:/bea/user_projects/domains/prod_domain',
'C:/bea/wlserver_10.0/common/nodemanager')
Running nmEnroll() ensures that the correct Node Manager user and password token are
supplied to each Managed Server. Once these are available for each Managed Server, you can
use nmConnect() in a production environment.
If Nmenroll failes for some reason, we need to copy SerializedsystemIni.dat and
nm_password.properties from Admin server to the new remote server. Additionally we can add
the domain name in nodemanager.domains file.
Session Persistence:
There are five different implementations of session persistence:
JDBC persistence
These attributes are part of the session-param element, which is a child element of the sessiondescriptor element in the weblogic.xml deployment descriptor file. We can get more detail about
weblogic deployment descriptor in Oracle's documentation.
Enabling Session Persistence:
Set the persistent-store-type parameter in the session-descriptor element in the weblogic.xml
deployment descriptor file to memory.
Enabling File system persistence:
In the deployment descriptor file weblogic.xml, set the persistent-store-type parameter in the
session-descriptor element in the weblogic.xml deployment descriptor file to file.
Create the necessary file store.
Enabling JDBC persistence
Set the persistent-store-type parameter in the session-descriptor element in the weblogic.xml
deployment descriptor file to jdbc
Set a JDBC connection pool to be used for persistence storage with the persistent-storepool parameter in the session-descriptor element in the weblogic.xml deployment descriptor file
Create JDBC datasource and tables in database.
We can use Administration Console or the WebLogic Scripting Tool (WLST) to create and
deploy (target) JDBC modules. They can be manged using JMX
Using weblogic console : http://sureshsvn.com/creatingjdbcconnectionpool.html
DB Ping command:
java -classpath /bea103/wl_server103/server/lib/weblogic.jar utils.dbping ORACLE_THIN
<dbUserName> <dbPasswoes> <dbURL>
JDBC Drivers :
The JDBC API defines the Java interfaces and classes that programmers use to
connect to databases and send queries. A JDBC driver implements these interfaces
and classes for a particular DBMS vendor.
The Oracle JDBC Thin driver is a JDBC Type 4 driver(written entirely in Java).
JDBC OCI client-side driver (OCI driver):
Oracle's JDBC OCI driver provides a JDBC Type 2 driver (native-API, partly Java)
implementation of the JDBC interfaces using OCI (Oracle Call Interface) to interact
with an Oracle database
JDBC server-side Internal driver (KPRB driver):
This JDBC Type 2 driver can be used by Java code that runs inside the oracle
database server JVM, such as Java stored procedures
DBC Thin server-side driver:
This JDBC Type 4 driver allows Java program running inside an Oracle database
server JVM to access remote databases.
BC Version JDK version**
11.2.0
1.6.x
1.5.x
ojdbc6.jar
ojdbc5.jar
11.1.0
1.6.x
1.5.x
ojdbc6.jar
ojdbc5.jar
10.2.0
1.2.x
1.3.x
1.4.x
1.5.x
classes12.jar
classes12.jar
ojdbc14.jar
ojdbc14.jar
10.1.0
1.2.x
1.3.x
1.4.x
classes12.jar
classes12.jar
ojdbc14.jar
9.2.0
1.1.x
1.2.x
1.3.x
1.4.x
classes111.zip*
classes12.zip*
classes12.zip*
ojdbc14.jar
Drivers
Oracle database
11.2.0
11.2.0
11.1.0
10.2.0
10.1.0
9.2.0
11.1.0
11.2.0
11.1.0
10.2.0
10.1.0
9.2.0
10.2.0
11.2.0
11.1.0
10.2.0
10.1.0
9.2.0
10.1
11.2.0
11.1.0
10.2.0
10.1.0
9.2.0
9.2.0
11.2.0
11.1.0
10.2.0
10.1.0
9.2.0
Oracle's JDBC Thin driver uses Java sockets to connect directly to Oracle. It provides its
own TCP/IP version of Oracle's SQL*Net protocol. Because it is 100% Java, this driver is
platform independent and can also run from a Web Browser (applets).
Logging Last Resource is recommended over Emulate Two-Phase Commit
Domain Creation :
We can create weblogic server domain using domain configuration wizard, weblogic.Server
command, weblogic.Admin command and WLST.
Using weblogic.Server command:
java -Dweblogic.Domain=SimpleDomain -Dweblogic.Name=SimpleServer
-Dweblogic.management.username=weblogic
-Dweblogic.management.password=weblogic -Dweblogic.ListenPort=7001
weblogic.Server
Create skeletal domain with the java weblogic.Server command and Using CREATE -mbean
argument to create different mbeans.
Using WLST: (
http://download.oracle.com/docs/cd/E11035_01/wls100/config_scripting/domains.html )
WLST enables you to create a new domain or update an existing domain without connecting to a
running WebLogic Server (that is, using WLST offline)supporting the same functionality as
the Configuration Wizard.
createDomain(domainTemplate, domainDir, user, password)
ls:/offline> createDomain('c:/bea/wlserver_10.0/common/templates/domains
/wls_medrec.jar','c:/bea/user_projects/domains/medrec', 'weblogic',
'weblogic')
Domain teamplates can be build using
Weblogic.Admin:
Usage: java [<SSL trust options>] weblogic.Admin [ [-url | -adminurl]
[<protocol>://]<listen-address>:<port>]
-username <username> [-password <password>]<COMMAND> <ARGUMENTS>
weblogic.Server :
Syntax
The java weblogic.Server -help command returns a list of frequently used options.
JMS:
The main components of JMS in weblogic are JMS servers, Store and Forward agents,
JMS Modules and Bridges
JMS Servers:
Management containers for JMS queue and topic destinations in JMS Modules that
are targetted to them. They provide persistence. They can be targetted to weblogic
servers.
Store and Forward Agents:
To send messages to remote subsystems. They have a capability to store the
messages and send them to the remote system when the remote system is not
available
JMS Modules:
They host and store information about several jms resouces such as connection
factory,queue,topic,DD,foriegn server etc.,
Persistent Store:
A persistent store is a physical repository for storing subsystem data, such as persistent JMS
messages. It can be either a JDBC-accessible database or a disk-based file. We can target
Persisent stores to both Admin and managed servers.
JMS Resource
Valid Targets
Queue
JMS server
Topic
JMS server
Connection factory
Uniform distributed
queue
JMS Resource
Valid Targets
Uniform distributed
topic
Foreign server
SAF imported
destinations
configuration files :
config.xml
DefaultAuthenticatorInit.ldift, DefaultRoleMapperInit.ldift, and SerializedSystemIni.dat, which
store basic security-related data.
boot.properties file, which contains the username and password in an encrypted format. This file
enables you to bypass the prompt for username and password when you start the server.
Weblogic Clustering:
A cluster defines groups of WebLogic Server servers that work together to increase
scalability and reliability.
For higher performance throughput, set the minimum java heap size equal to the maximum heap
size. For example:
"%JAVA_HOME%\bin\java" -server Xms512m Xmx512m -classpath %CLASSPATH% Configuring On-Demand Deployment
With native muxers, you may be able to improve throughput for some cpu-bound applications
(for example, SpecJAppServer) by using the following:
-Dweblogic.socket.SocketMuxer.DELAY_POLL_WAKEUP=xx
Limiting Requests in the Thread Pool
Throttle the thread pool by setting the Shared Capacity For Work Managers field in the
Administration Console
Limiting HTTP Sessions
An administrator can limit the number of active HTTP sessions based on detection of a low
memory condition. This is useful in avoiding out of memory exceptions.
<session-descriptor>
<max-in-memory-sessions>12</max-in-memory-sessions>
</session-descriptor>
If many connections are dropped or refused at the client, and no other error
messages are on the server, the Accept Backlog value might be set too low.
If you are getting connection refused messages when you try to access
WebLogic Server, raise the Accept Backlog value from the default by 25
percent. Continue increasing the value by 25 percent until the messages
cease to appear.
Tuning JDBC:
Tune the Number of Database Connections
A straightforward and easy way to boost performance of JDBC in WebLogic Server applications
is to set the value of Initial Capacity equal to the value for Maximum Capacity when configuring
connection pools in your data source
Use Test Connections on Reserve with Care
Test Frequency is the tunable parameter that allows us to define the number of seconds between
each time weblogic server tests unused connections.
Cache Prepared and Callable Statements
Use Statement Cache to cache statements. We can enable this under connection pool parameters
of JDBC
PinnedToThread
PinnedToThread is an option that can improve performance by enabling execute threads to keep
a pooled database connection even after the application closes the logical connection
The weblogic-cmp-jar.xml fileis WebLogic-specific XML Schema-based (XSD) deployment
descriptor file. Use these definitions to create the WebLogic-specific weblogic-cmp-jar.xml file
that is part of your EJB deployment. Use this deployment descriptor file to specify containermanaged-persistence (CMP) behavior.
Set cluster-invalidation-disabled to disable cluster invalidation.
Increase the number of CPUs only if CPU untilizaion is reaching high levels. Otherwise consider
increasing network and disk bandwidth etc.,
Tuning Chunk Size:
Weblogic JVM divides network data into 4 chunks by default. For network intensive applications
tuning chunk size can sometimes double thoroughput. The chunk size is set via command link in
server and client.
-Dweblogic.chunksize=n
Default is 4 Kb.
Weblogic caches chunks in an internal chunkpool for reuse.
-Dweblogic.utils.io.chunkpoolsize=n.
Default is 512
Using file stores gives more performance over JDBC persistance stores.
DebugConfigInfo ON
MatchExpression *.jsp
MatchExpression *.xyz
</IfModule>
Official Documentation:
Plugin options:
http://download.oracle.com/docs/cd/E13222_01/wls/docs81/plugins/plugin_params.html#115801
0
Dweblogic.Debug is the debug parameter that can be added while weblogic server starts using
startup scripts, WLST tools,
Through WLST:
user='user1'
password='password'
url='t3://localhost:7001'
connect(user, password, url)
edit()
cd('Servers/myserver/ServerDebug/myserver')
startEdit()
set('DebugJDBCJTA','true')
save()
activate()
Its used to export the deployment configuration parameters into an xml and use the same xml file
to deploy the code in multiple environments making few changes to the parameters without
needing to edit them in the EAR file descriptors or Admin console.
weblogic.PlanGenerator is the utility that can be used to create a deployment plan.
Syntax:
java weblogic.PlanGenerator [options] [path to application]
options include :
-plan : Name of the plan
-dependencies : export all dependency properties that resolve external resource references
(defaultl)
-declarations: export all properties that delcare a resource to other applications and modules.
-configurables : export all editable configurables except dependencies and declarations
-dynamics: export all configurables that be changed on the fly, without needing to redeploy the
application.
-all : export all changable parameters
While deploying the application using the weblogic.Deployer utility we need to use -plan
/pathto_xml_plan to deploy using plan.
WLST
Its a Jython based scripting tool that allows us to monitor and manage weblogic
servers. Almost all administration tasks are possible using wlst. It works is online as
well as offline modes (Interactive script and embedded) Its very interesting and
convenient
Initiate wlst:
D:\Oracle\Middleware\wlserver_10.3\server\bin>java weblogic.WLST
We can use the basic commands like ls and pwd once we connect to domain.
wls:/lab/serverConfig> pwd ()
serverConfig:/'
wls:/lab/serverConfig> ls ()
dr-- AdminConsole
dr-- AppDeployments
dr-- BridgeDestinations
To start Editing use the commands below: At any point if we see errors we
can use dumpStack() to see the trace. Use activate () to activate the
changes and exit out of edit mode.
wls:/lab/serverConfig> edit()
Location changed to edit tree. This is a writable tree with
DomainMBean as the root. To make changes you will need to start
an edit session via startEdit().
To check that state of a running server (Admin server in this example) and
take thread dump:
wls:/lab/serverConfig> cd('Servers/AdminServer')
wls:/lab/serverConfig/Servers/AdminServer> state ("AdminServer")
Current state of 'AdminServer' : RUNNING
wls:/lab/serverConfig/Servers/AdminServer> pwd ()
'serverConfig:/Servers/AdminServer'
threadDump("./dumps/threadDumpAdminServer.txt")
Migrating JMS and JTA services from 'server1' to destination 'server2' ...
wls:/mydomain/edit !>
wls:/mydomain/edit !> migrate('server1','machine1', 'true', 'false', 'server')
Migrating singleton server services from 'server1' to machine 'machine1' ...
wls:/mydomain/edit !>
Suspending a server:
wls:/mydomain/serverConfig> suspend('managed1')
Server 'managed1' suspended successfully.
wls:/mydomain/serverConfig>
Start a cluster:
ydomain/serverConfig> start('mycluster', 'Cluster')
Starting the following servers in Cluster, mycluster: MS1, MS2, MS3...
......................................................................
All servers in the cluster mycluster are started successfully.
wls:/mydomain/serverConfig>
Resume a server:
wls:/mydomain/serverConfig> resume('managed1', block='true')
Server 'managed1' resumed successfully.
wls:/mydomain/serverConfig>
Deployment descriptors are xml documents that describe runtime behaviour for the deployment
unit. The XML file contains information such as the context root of the web application and the
mapping of the portable names of an application's resources to the application Server's resources
WEB-INF folder contains all the class files for your servlets and classes that are called up by
your JSPs
Environment Scripts:
<DOMAIN_HOME>/bin/setDomainEnv.cmd (sh) script. This sets up all the environment
variables.
Where DOMAIN_HOME is the complete installation path for the domain.
D:\bea\user_projects\domains\lab
ANT
wlserver task is predefined in the version of Ant shipped with WebLogic Server.
ejbjar is one more built in task for working with EJBs
Example build file:
<ejbjar srcdir="build"
descriptordir="descriptor">
<weblogic destdir="build/deploy"
classpath="${weblogic.classpath}:build"
compiler="javac"/>
<include name="**/*-ejb-jar.xml"/>
<exclude name="**/*weblogic*.xml"/>
</ejbjar
If you want to use the task with your own Ant installation, add the following task definition in
your build file:
<taskdef name="wlserver" classname="weblogic.ant.taskdefs.management.WLServer"/
<target name="wlserver-default">
<wlserver/>
</target>
Provide the Private Key Alias (the one we provided while generating private key) and
passphrase.