# TO CONNECTING TO A WEBLOGIC SERVER INSTANCE THROUGH AN SSL LISTEN PORT
java -Dweblogic.security.SSL.ignoreHostnameVerification=true -Dweblogic.security.TrustKeyStore=DemoTrust weblogic.WLST
# TO CONNECT TO WEBLOGIC SERVER WITHOUT SSL
java weblogic.WLST
# JYTHON SYNTAX FOR SPECIFYING THE PATH(\)
readTemplate(r'c:\mytemplate.jar')
# TO CONNECT TO RUNNING SERVER IN WLST(on default port(7001))
connect('username','password')
# TO CONNECT TO RUNNING SERVER IN WLST(on user specified port)
connect('username','password','localhost:7007')
# CREATING A DOMAIN (Offline)
We can create a domain by using WLST in 2 ways:
1. Create a new domain using a specified template.
createDomain(domainTemplate,domainDir, user, password)
EX.
createDomain('D:/WLS/WLS922/weblogic92/common/templates/domains/wls.jar','D:/WLS/WLS922/user_projects/domains/base_domain','weblogic','weblogic')
2.
1. Open an existing domain template for domain creation
readTemplate(templateFileName)
2. Modify the domain (optional)
Various commands
3. Set the password for the default user, if it is not already set
cd('/Security/domainname/User/username')
cmo.setPassword('password')
4. Write the domain configuration information to the specified directory
writeDomain(domainDir)
5. Close the current domain template
closeTemplate()
# UPDATING AN EXISTING DOMAIN (Offline)
1. Open an existing domain for update
readDomain(domainDirName)
2. Extend the current domain (optional)
addTemplate(templateFileName)
3. Modify the domain (optional)
Various commands
4. Save the domain
updateDomain()
5. Close the domain
closeDomain()
# BROWSING AND ACCESSING INFORMATION ABOUT THE CONFIGURATION BEAN HIERARCHY (Offline)
EXAMPLES
1. Navigate the hierarchy of configuration beans
cd(path) cd('Servers/MS1')
2. List child attributes or configuration beans for the current configuration bean
ls(['a' | 'c']) ls()
3. Toggle the display of the configuration bean navigation path information at the prompt
prompt(['off'|'on']) prompt('off')
4. Display the current location in the configuration bean hierarchy
pwd() pwd()
5. Display all variables used by WLST
dumpVariables() dumpVariables()
6. Display the stack trace from the last exception that occurred while performing a WLST action
dumpStack() dumpStack()
# EDITING A DOMAIN (Offline)
1. Assign configuration beans
assign(sourceType, sourceName,destinationType, destinationName)
2. Unassign configuration beans
unassign(sourceType, sourceName,destinationType, destinationName)
3. Create and delete configuration beans
create(name, childMBeanType)
delete(name, childMBeanType)
4. Get and set attribute values
get(attrName)
set(attrName, value)
5. Set configuration options
setOption(optionName, value)
6. Load SQL files into a database
loadDB(dbVersion, connectionPoolName)
# EXPORTING DIAGNOSTICS DATA (Offline)
Execute a query against the specified log file
exportDiagnosticData([options])
# CHANGING THE CURRENT MANAGEMENT OBJECT(CMO)
When you navigate to an MBean type, the value of cmo reflects the parent MBean.
When you navigate to an MBean instance, WLST changes the value of cmo to be the currentMBean instance
command cmo
# DISPLAYING CONFIGURATION MBEANS
the ls command lists all the child MBeans and attributes.
command ls()
NOTE:
1. In the ls command output information, d designates an MBean with which you can use the cd
command (analogous to a directory in a file system), r indicates a readable property, w indicates
a writeable property, and x an executable operation.
2. The ls command property information is based on MBeanInfo; it does not reflect user permissions.
To navigate back to a parent MBean
cd(’..’)
To get back to the root MBean after navigating to an MBean that is deep in the hierarchy
cd(’/’)
# BROWSING RUNTIME MBEANS
serverRuntime ----> When connected to a Managed Server, the root of the runtime MBeans is ServerRuntimeMBean.
domainRuntime ----> the domainRuntime command, at the root of the domain-wide runtime management objects, DomainRuntimeMBean.
# NAVIGATING AMONG MBEAN HIERARCHIES
STEPS TO NAVIGATE AMONG MBEAN HIERARCHIES:
1. To navigate to a configuration MBean from the runtime hierarchy, enter the serverConfig or domainConfig.
2. You navigate through directories(which are server directories AdminServers,managedServers)
example: cd('Servers/AdminServers')--->cd('Log/AdminServer')
3. Then you enter serverRuntime() command
4. You navigate through directories(runtime MBeans directories)
example: cd('JVMRuntime/AdminServer')
5. you enter serverConfig() command, it returns previous navigate path(Log/AdminServer path).
6. you enter serverRuntime() command, it returns previous navigate path(JVMRuntime/AdminServer path).
Alternatively, you can use the currentTree command to store your current MBean hierarchy location and to return to that location after navigating away from it.
STEPS:
1. In serverConfig naviagated path enter the following command
myLocation = currentTree()
2. In serverRuntime navigated path enter following command
myLocation()
it returns the serverConfig path which already navigated through it and that is stored in currentTree()
# FINDING MBEANS
To locate a particular MBean and attribute, you use the find command. WLST returns the pathname to the MBean that stores the attribute and its value. You can use the getMBean
command to return the MBean specified by the path.
EXAMPLES:
1. find('logfilename') ---> it returns the paths that where this files are exists.
2. a. bean=getMBean('Servers/myserver')
b. print bean ---> it returns mbean of that particular server with Name and Type
3. a. path=getPath('com.bea:Name=myserver,Type=Server')
b. print path ---> it returns path to specified type(Server)
# ACCESSING CUSTOM MBEANS
WebLogic Server provides hundreds of MBeans, many of which you use to configure and monitor EJBs, Web applications, and other deployable J2EE modules. If you want to use
additional MBeans to configure your applications or resources, you can create and register your own MBeans within the MBean Server subsystem on the Administration Server.
To navigate custom MBeans, enter the custom command when WLST is connected to an
Administration Server or a Managed Server instance.
command() ---> it returns all MBeans that are defined by users...
# EDITING CONFIGURATION MBEANS
STEPS:
1. edit()
2. startEdit()
3. editing commands (create,invoke,delete) EXAMPLE: cmo.createServer('MS1')
4. save()
5. undo() (optional) i.e., You can make additional changes, without re-entering the startEdit command
6. activate() i.e., When you are ready to distribute your changes to the working configuration MBeans
7. stopEdit() or cancelEdit() (optional) i.e., you can abandon your changes
getActivationTask() ---> provides information about the activation request and returns the latest ActivationTaskMBean
# MANAGING SERVERS AND SERVER LIFE CYCLE
During its lifetime, a server can transition through a number of operational states, such as shutdown, starting, standby, admin, resuming, and running. WLST commands such as start,
suspend, resume, and shutdown cause specific changes to the state of a server instance.
# STARTING AND STOPPING SERVERS
# STARTING AN ADMIN SERVER WITHOUT NODE MANAGER
1. open command prompt and navigate to domains directory
EX: cd D:\WLS\WLS922\user_projects\domains\base_domain
2. set the path i.e., setDomainEnv.cmd(in \base_domain\bin)
3. java weblogic.WLST
4. Use the WLST startServer command to start the Administration Server.
SYNTAX:startServer([adminServerName], [domainName], [url], [username],
[password],[domainDir], [block], [timeout], [serverLog],
[systemProperties], [jvmArgs])
EXAMPLE: startServer('AdminServer','base_domain','localhost:7001','weblogic','weblogic','D:/WLS/WLS922user_projects/base_domain','true',60000,'false')
# STARTING MANAGED SERVERS AND CLUSTERS WITH NODE MANAGER
1. FOLLOW ABOVE UPTO 2ND STEPS
2. java weblogic.WLST
3. startNodeManager()
4. TAKE ANOTHER COMMAND PROMPT START ADMIN SERVER
5. TAKE ANOTHER COMMAND PROMPT
java weblogic.WLST
6. start('MS1','Server') or start('MS1','Server','localhost:7003')
7. start('mycluster','Cluster')
# USING WLST AND NODE MANAGER TO MANAGE SERVERS
# START ADMIN SERVER USING NODE MANAGER
The following example uses WLST Node Manager commands to start, monitor, and stop an Administration Server.
1. java weblogic.WLST
2. startNodeManager()
3. connect to the node manager
SYNTAX: nmConnect('username','password','nmHost','nmPort','domainName','domainDir','nmType')
EXAMPLE: nmConnect('weblogic','weblogic','localhost','5556','base_domain','D:/WLS/WLS922user_projects/domains/base_domain') ------> for general
nmConnect('weblogic','weblogic','localhost','5556','base_domain','D:/WLS/WLS922/user_projects/domains/base_domain','ssl')------> for SSL
4. Use the nmStart command to start an Administration Server.
SYNTAX: nmStart('ADMINSERVER_NAME')
EXAMPLE: nmStart('AdminServer')
5. Monitor the status of the server you started by entering the nmServerStatus command
SYNTAX: nmServerStatus('ADMINSERVER_NAME')
EXAMPLE: nmServerStatus('AdminServer')
6. Stop the server by entering the nmKill command.
SYNTAX: nmKill('ADMINSERVER_NAME')
EXAMPLE: nmKill('AdminServer')
# MONITORING SERVER STATE
# TO RETURN THE STATE OF A SERVER or CLUSTER.
state('managed1','Server')
# OVER VIEW OF WSLT COMMAND CATEGORIES
WLST commands are divided into the following categories.
1. Browse Commands ------> • Navigate the hierarchy of configuration or runtime beans
and control the prompt display.
2. Control Commands ------> • Connect to or disconnect from a server.
• Create and configure a WebLogic domain or domain template.
• Exit WLST.
3. Deployment Commands ------> • Deploy, undeploy, and redeploy applications and standalone
modules to a WebLogic Server instance.
• Update an existing deployment plan.
• Interrogate the WebLogic Deployment Manager object.
• Start and stop a deployed application.
4. Diagnostics Commands ------> • Export diagnostic data.
5. Editing Commands ------> • Interrogate and edit configuration beans.
6. Information Commands ------> • Interrogate domains, servers, and variables, and provide configuration bean,
runtime bean, and WLST-related information.
7. Life Cycle Commands ------> • Manage the life cycle of a server instance
8. Node Manager Commands------> • Start, shut down, restart, and monitor WebLogic Server instances using Node Manager.
9. Tree Commands ------> • Navigate among MBean hierarchies.
# BROWSE COMMANDS
1. cd Navigate the hierarchy of configuration or runtime beans. Online or Offline
2. currentTree Return the current location in the hierarchy. Online
3. prompt Toggle the display of path information at the prompt. Online or Offline
4. pwd Display the current location in the hierarchy. Online or Offline
cd
---
cd('..') The character string ..(dot-dot), refers to the directory immediately above the current
directory.
cd('/') To get back to the root bean after navigating to a bean that is deep in the hierarchy.
currentTree
-----------
currentTree() stores the current location in the hierarchy.
prompt
------
prompt(myPrompt)
Toggles the display of path information at the prompt, when entered without an argument.
prompt(off)
When you specify off, WLST hides the WLST prompt and defaults to the Jython prompt.
prompt(on) It displays the path information in prompt.
pwd
----
pwd Displays the current location in the configuration or runtime bean hierarchy.
# CONTROL COMMANDS
Connect to and “connect” Connect WLST to a WebLogic Server instance.
- Online or Offline
disconnect from a “disconnect” Disconnect WLST from a WebLogic Server instance.
WebLogic Server
instance - Online
Create a new domain “createDomain” Create a new domain using the specified template.
from a domain template
- Offline
Read a domain from “readTemplate” Open an existing domain template for domain
domain template
- Offline
Create a domain “writeDomain” Write the domain configurationinformation to the template
- Offline
Close the “closeTemplate” Close the current domain template.
template
- Offline
Update an existing “readDomain” Open an existing domain for updating.
domain - Offline
“addTemplate” Extend the current domain using an
application or service extension template.
“updateDomain” Update and save the current domain.
“closeDomain” Close the current domain.
Write a domain “writeTemplate” Writes the configuration information to the
template specified domain template file.
- Offline
Exit WLST “exit” Exit WLST from the interactive session and close
- Online or Offline the scripting shell.
addTemplate addTemplate Extends the current domain using an application
- Offline or service extension template.
closeDomain closeDomain Closes the current domain. The domain is no
- Offline longer available for editing once it is closed.
closeTemplate closeTemplate Closes the current template. The domain is no
Offline longer available for editing once it is closed.
connect connect Connect WLST to a WebLogic Server instance.
- Online or Offline
EXAMPLE:
1.connect() -------->
a. WLST searches for the default user configuration and key files that contain an encrypted username and password. This information must be valid for your current domain.
b. If the connect command was run from the domain directory in which the server was started, WLST attempts to load the username and password from the boot.properties file.
c. WLST prompts for a username, password, and URL.
2.connect('username','password','url','AdminServerName')
3.connect('username','password','url')
4.connect('username','password') ------> for default server port (7001)
5.connect([userConfigFile, userKeyFile], [adminServerName])
6.connect([userConfigFile, userKeyFile], [url], [adminServerName])
7.connect([userConfigFile, userKeyFile]) ------> for default server port (7001)
8. a. username = 'weblogic'
b. password = 'weblogic'
c. connect(username,password,'t3://myhost:8001')
9. a. username = 'weblogic'
b. password = 'weblogic'
c. connect(username,password) ------> for default server port (7001)
0 comments:
Post a Comment