Tuesday, November 18, 2014

WLST: Offline and Online Modes

In this article, we will cover the following topics:
  • How to invoke WLST?
  • Offline and Online WLST
  • How to switch from Offline to Online mode?

How to invoke WLST?


In a Windows environment, you can start WLST from the Start program by simply selecting:
Start | Programs | Oracle | Oracle Home | WebLogic Server 12c | Tools | WebLogic Scripting Tool
You can also invoke WLST from the command line by using:[1]
  • The java weblogic.WLST command or 
  • The command script wlst.cmd (wlst.sh in UNIX)

java weblogic.WLST Command

D:\>cd Oracle\wls1036tx\user_projects\domains\base1_domain\bin
D:\Oracle\wls1036tx\user_projects\domains\base1_domain\bin>setDomainEnv.cmd
D:\Oracle\wls1036tx\user_projects\domains\base1_domain>java weblogic.WLST

Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands

wls:/offline>

Command Script wlst.cmd

D:\>cd Oracle\wls1036tx\oracle_common\common\bin
D:\Oracle\wls1036tx\user_projects\domains\base1_domain\bin> wlst.comd
CLASSPATH=C:\Oracle\MIDDLE~1\patch_wls1211\profiles\default\sys_manifest_classpath\weblogic_patch.jar;...

Initializing WebLogic Scripting tool (WLST)...
Type help() for help on available commands

wls:/offline>

Note that you use the wlst.cmd script from the ORACLE_HOME\oracle_common\common\bin directory and not a directory specific to any particular WebLogic Server domain.[1]

Offline and Online WLST


As shown above, both WLST invocations bring you to the offline mode.  In the next section, we will show how to switch from offline to online mode and vice versa.  To begin with, here are what offline and online mode can and can't do:[5]


WLST Offline
WLST Online
Can Do
  • Create/modify domain templates
  • Create domains
  • Extend an existing domains by access and modify the configuration for an offline domain
  • Change configuration when servers are in RUNNING state
  • View runtime data for monitoring various runtime MBeans performances
  • Deploy applications targeting to Servers or clusters
  • Start and stop servers or cluster members.
Can't Do
  • View runtime performance data
  • Modify security data
  • Create a new domain (must be offline mode)
    • You can only update an existing domain configuration.


Online Mode

In online mode, WLST needs to connect to an active Admin or Managed Server.  The WLST online commands are analogous to the Administration Console changes after connecting to Admin Server.  WLST in online mode acts as a Java Management Extensions (JMX) client that manages the domain's resources by modifying the server's in-memory runtime Management Beans (MBeans). Thus, WLST offers you all the domain management configuration capabilities as the Administration Console.

Offline Mode

In offline mode, WLST helps you extend a domain, create domain templates, and create domains with those templates. Since you aren't connected to an active Admin Server, you won't be able to modify domain configuration in offline mode.

The WLST offline configuration commands are analogous to the Configuration Wizard. You just need to know the navigation on the configuration MBean trees, modify the MBean attribute values. Internally WLST offline commands work on WebLogic domain Configuration Framework, which Configuration Wizard also uses.  Using either tool, modified configuration data are persisted consistently in  the domain’s config directory or in a domain template JAR.

You can list a summary of all online and offline commands from the command-line using the following commands, respectively:[3,4]
help("online")
help("offline")

How to Switch from Offline to Online mode?


You can switch from offline to online mode and vice versa by using connect() and disconnect() commands. When you use connect() command at offline it will transfer your prompt to ServerConfig that indicates online command mode.  The following example shows you how:
wls:/offline> connect('weblogic', 'welcome1', 't3://myserver:7001')

Connecting to t3://myserver:7001 with userid weblogic ...
Successfully connected to Admin Server "myserver" that belongs to domain "mydomain".

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

wls:/mydomain/serverConfig> disconnect()

Disconnected from weblogic server: myserver

In order to...
Use this command...
To...
Use with WLST...
Connect to and disconnect from a WebLogic Server instance
Connect WLST to a WebLogic Server instance.
Online or Offline
Disconnect WLST from a WebLogic Server instance.
Online


References

1 comment:

Blogger said...

Bluehost is ultimately one of the best hosting company for any hosting plans you might need.