WLST: Information Commands

Overview

* Use the WLST information commands to
– interrogate domains, servers, and variables,
– and provide configuration bean, runtime bean, and WLST-related information.

Commands

addListener

* Add a JMX listener to the specified MBean.
* Online.
* Syntax:

addListener(mbean, [attributeNames], [logFile], [listenerName])

* Examples:

addListener(cmo, "Notes,ArchiveConfigurationCount","./listeners/domain.log","domain-listener")

configToScript

* Convert an existing server configuration (config directory) to an executable WLST script.
* Online or Offline.
* Syntax:

configToScript([configPath], [pyPath], [overwrite], [propertiesFile], [createDeploymentScript])

* Examples:

wls:/offline> configToScript() 
wls:/offline> configToScript('c:/Oracle/Middleware/user_projects/domains/mydomain','c:/Oracle/Middleware/myscripts')

dumpStack

* Display stack trace from the last exception that occurred while performing a WLST action, and reset the stack trace.
* Online or Offline.
* Syntax:

dumpStack()

* Examples:

wls:/offline> dumpStack()
This Exception occurred at Wed Sep 21 11:54:18 EDT 2011.
weblogic.management.scripting.ScriptException: Error occured while performing configToScript : Error making set beans.
Use dumpStack() to view the full stacktrace
        at weblogic.management.scripting.ExceptionHandler.handleException(ExceptionHandler.java:50)

dumpVariables

* Display all variables used by WLST, including their name and value.
* Online or Offline.
* Syntax:

dumpVariables()

* Examples:

wls:/basicWLSDomain/serverConfig> dumpVariables()
adminHome                     weblogic.rmi.internal.BasicRemoteRef - hostID: '-757338143456366624S:127.0.0.1:[7001,7001,-1,-1,-1,-1,-1]:basicWLSDomain:AdminServer', oid: '259', channel: 'null'
cmgr                          [MBeanServerInvocationHandler]com.bea:Name=ConfigurationManager,Type=weblogic.management.mbeanservers.edit.ConfigurationManagerMBean
cmo                           [MBeanServerInvocationHandler]com.bea:Name=basicWLSDomain,Type=Domain
connected                     true
domainName                    basicWLSDomain

find

* Find MBeans and attributes in the current hierarchy.
* Online.
* Syntax:

find([name], [type], [searchInstancesOnly])

* Examples:

wls:/basicWLSDomain/serverConfig> find(name = 'JavaCompiler')
Finding 'JavaCompiler' in all registered MBean instances ...
/Servers/AdminServer                           JavaCompiler
                  javac
/Servers/AdminServer                           JavaCompilerPostClassPath
                  null
/Servers/AdminServer                           JavaCompilerPreClassPath
                  null
/AppDeployments/mejb/AppMBean/mejb/Components/mejb JavaCompiler
                      null
/AppDeployments/mejb/AppMBean/mejb/Components/mejb JavaCompilerPreClassPath
                      null
/AppDeployments/mejb/AppMBean/mejb/Components/mejb JavaCompilerPostClassPath
                      null
 
wls:/basicWLSDomain/serverConfig> find(type='JMSRuntime')
Finding MBean of type JMSRuntime in all the instances ...
No results found in MBean Instances
 
wls:/basicWLSDomain/serverConfig> find(name='execute', searchInstancesOnly='false')
Finding 'execute' in all registered MBean instances ...
/Servers/AdminServer                           Use81StyleExecuteQueues
                  false
/Servers/AdminServer                           ExecuteQueues
                  [Ljavax.management.ObjectName;@1c53725
 
Now finding 'execute' in all MBean Types that can be instantiated ...

getConfigManager

* Return the latest ConfigurationManagerBean MBean which manages the change process.
* Online.
* Syntax:

getConfigManager()

* Examples:

wls:/basicWLSDomain/serverConfig> cm=getConfigManager()
wls:/basicWLSDomain/serverConfig> cm.getType()
'weblogic.management.mbeanservers.edit.ConfigurationManagerMBean'

getMBean

* Return the MBean by browsing to the specified path.
* Online.
* Syntax:

getMBean(mbeanPath)

* Examples:

wls:/basicWLSDomain/serverConfig> com=getMBean('Servers/AdminServer/COM/AdminServer')
wls:/basicWLSDomain/serverConfig> com.getType()
'COM'

getMBI

* Return the MBeanInfo for the specified MBeanType or the cmo variable.
* Online.
* Syntax:

getMBI([mbeanType])

* Examples:

wls:/basicWLSDomain/serverConfig> svrMbi=getMBI('weblogic.management.configuration.ServerMBean')
wls:/basicWLSDomain/serverConfig>

getPath

* Return the MBean path for the specified MBean instance.
* Online.
* Syntax:

getPath(mbean)

* Examples:

wls:/basicWLSDomain/serverConfig> path=getPath('com.bea:Name=AdminServer,Type=Server')
wls:/basicWLSDomain/serverConfig> print path
Servers/AdminServer

listChildTypes

* List all the children MBeans that can be created or deleted for the cmo type.
* Online.
* Syntax:

listChildTypes([parent])

* Examples:

wls:/basicWLSDomain/serverConfig> listChildTypes()
BridgeDestinations
CachingRealms
Clusters
CoherenceClusterSystemResources
CoherenceServers
CustomRealms
CustomResources

lookup

* Look up the specified MBean.
* Online.
* Syntax:

lookup(name, [childMBeanType])

* Examples:

wls:/basicWLSDomain/serverConfig> sbean=lookup('AdminServer','Server')
wls:/basicWLSDomain/serverConfig> sbean.getType()
'Server'
wls:/basicWLSDomain/serverConfig>

ls

* List all child beans and/or attributes for the current configuration or runtime bean.
* Online or Offline.
* Syntax:

ls( [ a | c | o ] [ moPath ])
ls( [ moPath ] returnMap [ returnType ] )

* Examples:

ls()
ls('a')
ls('Servers')

man

* Display help from MBeanInfo for the current MBean or its specified attribute.
* Online.
* Syntax:

man([attrName])

* Examples:

wls:/basicWLSDomain/serverConfig> man('Servers')
com.bea.creator : createServer
com.bea.description : <p>Returns the ServerMBeans representing the servers thathave been configured to be part of this domain.</p>
com.bea.destroyer : destroyServer
com.bea.dynamic : true
com.bea.relationship : containment
descriptorType : Attribute
displayName : Servers
interfaceclassname : [Lweblogic.management.configuration.ServerMBean;
Name : Servers

redirect

* Redirect WLST output to the specified filename.
* Online.
* Syntax:

<pre lang="bash">
redirect(outputFile, [toStdOut])

* Examples:

wls:/mydomain/serverConfig> redirect('./logs/wlst.log')

removeListener

* Remove a listener that was previously defined.
* Online.
* Syntax:

removeListener([mbean], [listenerName])

* Examples:

wls:/mydomain/serverConfig> removeListener(listenerName="mylistener")

showListeners

* Show all listeners that are currently defined.
* Online.
* Syntax:

showListeners()

* Examples:

wls:/basicWLSDomain/serverConfig> showListeners()
domain-listener: Listener for MBean com.bea:Name=basicWLSDomain,Type=Domain for attribute(s) Notes,ArchiveConfigurationCount
domain-listener2: Listener for MBean com.bea:Name=basicWLSDomain,Type=Domain for attribute(s) Notes,ArchiveConfigurationCount

startRecording

* Record all user interactions with WLST; useful for capturing commands to replay.
* Online or Offline.
* Syntax:

startRecording(recordFile, [recordAll])

* Examples:

wls:/mydomain/serverConfig> startRecording('c:/myScripts/record.py') 
Starting recording to c:/myScripts/record.py
wls:/mydomain/serverConfig>

state

* Returns a map of servers or clusters and their state using Node Manager.
* Online.
* Syntax:

state(name, [type])

* Examples:

wls:/mydomain/serverConfig> state('managed1','Server') 
Current state of "managed1": SUSPENDED 
wls:/mydomain/serverConfig>
 
wls:/mydomain/serverConfig> state('mycluster','Cluster') 
There are 3 server(s) in cluster: mycluster
 
States of the servers are
MServer1---SHUTDOWN
MServer2---SHUTDOWN
MServer3---SHUTDOWN
wls:/mydomain/serverConfig>

stopRecording

* Stop recording WLST commands.
* Online or Offline.
* Syntax:

stopRecording()

* Examples:

wls:/mydomain/serverConfig> stopRecording() 
Stopping recording to c:\myScripts\record.py
wls:/mydomain/serverConfig>

stopRedirect

* Stop redirection of WLST output to a file.
* Online or Offline.
* Syntax:

stopRedirect()

* Examples:

wls:/mydomain/serverConfig> stopRedirect() 
WLST output will not be redirected to myfile.txt any more

storeUserConfig

* Create a user configuration file and an associated key file.
* Online.
* Syntax:

storeUserConfig([userConfigFile], [userKeyFile], [nm])

* Examples:

wls:/basicWLSDomain/serverConfig> storeUserConfig('c:/TEMP/myuserconfigfile.secure', 'c:/TEMP/myuserkeyfile.secure')
Creating the key file can reduce the security of your system if it is not kept in a secured location after it is created. Do you want to create the key file? y or n
y
The username and password that were used for this WebLogic Server connection are stored in c:/TEMP/myuserconfigfile.secure and c:/TEMP/myuserkeyfile.secure.
wls:/basicWLSDomain/serverConfig>

threadDump

* Display a thread dump for the specified server.
* Online or Offline.
* Syntax:

threadDump([writeToFile], [fileName], [serverName])

* Examples:

wls:/mydomain/serverConfig> threadDump() 
wls:/mydomain/serverConfig> threadDump(writeToFile='false', serverName='managedServer')

viewMBean

* Display information about an MBean, such as the attribute names and values, and operations.
* Online.
* Syntax:

viewMBean(mbean)

* Examples:

wls:/basicWLSDomain/serverConfig> viewMBean(cmo)
Attribute Names and Values
--------------------------
VirtualHosts                                 null
DomainVersion                                10.3.4.0
ClusterConstraintsEnabled                    false
CoherenceClusterSystemResources              null
Servers                                      javax.management.ObjectName[com.bea:Name=AdminServer,Type=Server]
MigratableTargets                            null

writeIniFile

* Convert WLST definitions and method declarations to a Python (.py) file.
* Online or Offline.
* Syntax:

writeIniFile(filePath)

* Examples:

wls:/basicWLSDomain/serverConfig> writeIniFile("wl.py")
The Ini file is successfully written to wl.py
wls:/basicWLSDomain/serverConfig>

References

* Information Commands

This entry was posted in weblogic11g and tagged , , . Bookmark the permalink.

One Response to WLST: Information Commands

  1. Pingback: Weblogic WLST | ivannexus

Leave a Reply

Your email address will not be published. Required fields are marked *


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.