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

Saturday, September 1, 2012

Thread Dumps in WebLogic12c Server

Here going to provide information about 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

Tuesday, August 28, 2012

Disabling and enabling the Weblogic 12c Administration Console

To 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. To 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()

 

Saturday, August 25, 2012

Weblogic 12c Installation Directories Structure

Exploring Middleware Home Directory

By default, Weblogic 12c choose C:\Oracle\Middleware directory for installation on Windows.

Oracle\Middleware Directory









































































DirectoryContents
/ coherence_3.7Coherence home directory
/ jdk160_29Sun JDK ((Recommended for Development Mode))
/ jrockit_versionJRockit JDK (Recommended for Production Mode)
/ logsLocation for various log files about installation and uninstallation for the Middleware home directory.
/modulesLocation for modules such as Apache Ant
/ oepe_12.1.1.0.1Files related to Oracle Enterprise Package for Eclipse
/ patch_ocp371 
/ patch_oepe101 
/user_projectsContains Domain
/ utilscontains utilities that are used to support the installation of all products installed in this home directory.
/ wlserver_12.1WebLogic Server home directory
.homeThis file contains the information about the Middleware home directory.
domain-registry.xmlThis registry file contains the location of all domains currently registered with this WebLogic Server installation. Whenever you add a new domain, it is registered in this file.
ocm.rspThis response file contains information about the Oracle Configuration Manager (OCM) installation.
registry.datThis registry contains product-related information, such as version number, patch set level, patch level, and location of the product installation directories. It also contains the name of the installed JDK(s) and the Java home.
registry.xmlThis is an encrypted version of the registry.xml file.

WebLogic Server Home Directory(WL_HOME): By default it is located in the Oracle\Middleware\wlserver_12.1



WebLogic Server Domain Directory





















































DirectoryContent
/ autodeployIn a development environment, the server will automatically deploy any applications or modules you place here. You must run the server in development mode for it to take advantage of the automatic deployment feature.
/ binContains the start and stop scripts
/ configContains the key domain configuration file, config.xml.
/ console-extContains any Administration Console extensions you've created
/ init-info This directory contains files that are used for WebLogic domain provisioning. You should not modify any files in this directory.
/ libYou can place JAR files in this directory so they can be available to all applications running on the domain's server instances.
/ securityHolds security-related files such as SerializedSystemIni.dat.
/ serversThis is an important directory that contains a separate subdirectory for each of the servers in your domain, including both Admin and Managed Servers.
fileRealm.properties 
startWebLogic.cmd 
startWebLogic.sh 

Note:

Note while creating  the Middleware home directory:

  • Do not include spaces in the name of your Middleware home directory otherwise the CLASSPATH may not be resolved properly.

  •  You can install only one instance of each version of a WebLogic Server product in a single Middleware home directory. For example, you can install only one instance of the current version of WebLogic Server in a Middleware home directory, but you can have an earlier version of WebLogic Server in a separate Middleware home directory.

  • If the home directory is not empty and it does not contain registry.xml, or if any of the product installation directories are not empty, one of the following messages is displayed:


For home directory selection task—Middleware home directory is not empty. Proceed with installation?

For product installation directory selection task—One or more installation directories are not empty. Proceed with installation?

 

Friday, February 17, 2012

Starting Managed Servers without an Administration Server using Node Manager and WLST

Weblogic 12c


 

The steps for starting the Managed  Server without AdminServer using WLST and Node Manager are as follows :

i)  Setting up your environment.

Add WebLogic Server classes to the CLASSPATH environment variable and WL_HOME\server\bin to the PATH environment variable.  OR

You can use a  C:\Oracle\Middleware\wlserver_12.1\server\bin\setWLSEnv.cmd  script to set both variables.



 

ii)  Start WLST Session using command : java weblogic.WLST



iii)  Start Node Manager using command :

                         startNodeManager(verbose='true', NodeManagerHome='C:\\Oracle\\Middleware\\wlserver_12.1\\common\\nodemanager', ListenPort='5556', ListenAddress='localhost')





iv) Connect WLST to a Node Manager by entering the nmConnect command.

nmConnect('weblogic', 'weblogic123', 'localhost', '5556', 'base_domain' , 'C:\\Oracle\\Middleware\\user_projects\\domains\\base_domain' , 'ssl')



note: Node Manager security relies on a one-way SSL connection between the client and server.If you are establishing a command line connection to the Java Node Manager using the WebLogic Server Scripting Tool (WLST) nmConnect command, you provide the Node Manager user name and password(here weblogic and weblogic123 respectively). Node Manager verifies the username and password against the domain's nm_password.properties file.Node Manager credentials are located on the Security>General>Advanced Options of Console page.Administration Console users do not need to explicitly provide credentials to connect to Node Manager—the Node Manager user name and password are available in the domain configuration and are provided automatically.

v) Starts the managed server in the current domain using Node Manager. : nmStart('Server-0')



 

 

 Related Common Issues :


 

If you are trying to automate the environment using Node Manager and WLST .

And you are trying to Start the Admin Server and all the Managed Server using WLST only.

And the Managed servers are to be started for the first time using WLST and Node Manager then you may encounter the below error :

 






There are 1 nested errors:

weblogic.management.ManagementException: Booting as admin server, but servername, soa_server1, does not match the admin server name, AdminServer
at weblogic.management.provider.internal.RuntimeAccessService.start(RuntimeAccessService.java:67)
at weblogic.t3.srvr.ServerServicesManager.startService(ServerServicesManager.java:461)
at weblogic.t3.srvr.ServerServicesManager.startInStandbyState(ServerServicesManager.java:166)
at weblogic.t3.srvr.T3Srvr.initializeStandby(T3Srvr.java:879)
at weblogic.t3.srvr.T3Srvr.startup(T3Srvr.java:566)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:467)
at weblogic.Server.main(Server.java:71)


Cause :


The reason for the above error is that when the Managed Server are to be started for the first time using the Node Manager and WLST,  the boot.properties file ( at %domain_home%/servers/ManagedServer/security/) and startup.properties file ( %domain_home%/servers/ManagedServer/data/NodeManager/) should be already present.

Solution :


To generate the boot.properties file , and startup.properties file use the below WLST command :

 nmGenBootStartupProps('ms1') 


 

 

 

 

Starting the Managed Server Using Node Manager and WLST

Weblogic 12c


 

The steps for starting the Managed  Server  using WLST and Node Manager are as follows :

i)  Setting up your environment.

Add WebLogic Server classes to the CLASSPATH environment variable and WL_HOME\server\bin to the PATH environment variable.  OR

You can use a  C:\Oracle\Middleware\wlserver_12.1\server\bin\setWLSEnv.cmd  script to set both variables.



 

ii)  Start WLST Session using command : java weblogic.WLST



iii)  Start Node Manager using command :

                         startNodeManager(verbose='true', NodeManagerHome='C:\\Oracle\\Middleware\\wlserver_12.1\\common\\nodemanager', ListenPort='5556', ListenAddress='localhost')





iv) Connect WLST to a Node Manager by entering the nmConnect command.

nmConnect('weblogic', 'weblogic123', 'localhost', '5556', 'base_domain' , 'C:\\Oracle\\Middleware\\user_projects\\domains\\base_domain' , 'ssl')



note: Node Manager security relies on a one-way SSL connection between the client and server.If you are establishing a command line connection to the Java Node Manager using the WebLogic Server Scripting Tool (WLST) nmConnect command, you provide the Node Manager user name and password(here weblogic and weblogic123 respectively). Node Manager verifies the username and password against the domain's nm_password.properties file.Node Manager credentials are located on the Security>General>Advanced Options of Console page.Administration Console users do not need to explicitly provide credentials to connect to Node Manager—the Node Manager user name and password are available in the domain configuration and are provided automatically.

 

v) Use the nmStart command to start a server.
nmStart('AdminServer')



Monitor the status of the Administration Server by entering the nmServerStatus command.
nmServerStatus('AdminServer')

vi) Connect WLST to a running WebLogic Administration Server instance using the connect command.
connect('weblogic','weblogic123')



vii) To start a Managed Server or cluster, enter the following command:
start('Server-0','Server')
         start('mycluster', 'Cluster')



viii) Stop the server by entering the nmKill command.
nmKill('Server-0')



 

ix) Stop the AdminServer by entering the nmKill command.
nmKill('AdminServer')



  x) Disconnect the node manager :     nmDisconnect()   and   Exit the WLST:     exit()



note:  To find node manager process :
For windows
netstat -ao| findstr 5556
TCP    ajit:5556              ajit:0                 LISTENING       1900

here : PID - 1900.

For Linux/unix :

netstat -an | grep -v grep | grep weblogic.NodeManager

 

 

Starting the Administration Server Using Node Manager and WLST

Weblogic 12c


The steps for starting an Administration Server using WLST and Node Manager are :

 

i)  Setting up your environment.

Add WebLogic Server classes to the CLASSPATH environment variable and WL_HOME\server\bin to the PATH environment variable.  OR

You can use a  C:\Oracle\Middleware\wlserver_12.1\server\bin\setWLSEnv.cmd  script to set both variables.



 

ii)  Start WLST Session using command : java weblogic.WLST



iii)  Start Node Manager using command :

                         startNodeManager(verbose='true', NodeManagerHome='C:\\Oracle\\Middleware\\wlserver_12.1\\common\\nodemanager', ListenPort='5556', ListenAddress='localhost')





iv) Connect WLST to a Node Manager by entering the nmConnect command.

nmConnect('weblogic', 'weblogic123', 'localhost', '5556', 'base_domain' , 'C:\\Oracle\\Middleware\\user_projects\\domains\\base_domain' , 'ssl')



note: Node Manager security relies on a one-way SSL connection between the client and server.If you are establishing a command line connection to the Java Node Manager using the WebLogic Server Scripting Tool (WLST) nmConnect command, you provide the Node Manager user name and password(here weblogic and weblogic123 respectively). Node Manager verifies the username and password against the domain's nm_password.properties file.Node Manager credentials are located on the Security>General>Advanced Options of Console page.Administration Console users do not need to explicitly provide credentials to connect to Node Manager—the Node Manager user name and password are available in the domain configuration and are provided automatically.

 

v) Use the nmStart command to start a server.
nmStart('AdminServer')



Monitor the status of the Administration Server by entering the nmServerStatus command.
nmServerStatus('AdminServer')

vi) Connect WLST to a running WebLogic Administration Server instance using the connect command.
connect('weblogic','weblogic123')



vii) Stop the AdminServer by entering the nmKill command.
nmKill('AdminServer')



viii) Disconnect the node manager :     nmDisconnect()   and   Exit the WLST:     exit()