SlideShare a Scribd company logo
1 of 27
Download to read offline
WLST: WebLogic’s
Swiss Army Knife
Simon Haslam
Consultant/founder of Veriton & co-founder O-box
FMW infra: high availability, security, performance
Chair of UKOUG Middleware SIG
Middleware focus, but interested from hardware upwards
 What is WLST?
 WLST & Management Beans Overview
 Language Features
WLST Overview
 Jython = Python running on JVM
 JMX are management APIs for
Java (implemented as Mbeans)
 WLST provides front-end to JMX
◦ a little like ‘SQL*Plus for WebLogic’
 Since 12c admin functions
possible over RESTful interface
WebLogic
MBeans
Jython
WebLogic
extensions WLST
REST
Getting started
 Usually connect to Admin Server ‘online’
 Run wlst.sh [.cmd] or use Windows short-cut
◦ connect(<username>,<password>,<url>)
 What is WLST?
 WLST & Management Beans Overview
 Language Features
Management Beans Overview
 All WebLogic servers
◦ Runtime WebLogic MBeans
◦ JVM MBeans
 Admin Server only
◦ Domain Runtime MBeans
◦ “edit” MBeans
System Change Management
 edit()
 startEdit()
 save()
 activate() <= prod. mode releases lock
◦ or undo()
 Configuration lock held by user (not tool) so WLST startEdit will
show that the domain is being edited in the WLS console
MBean Access
cd()
ls()
easeSyntax()
find(‘ListenAddress’);
wls:/wls1213test1/serverConfig/Machines/think-x220> find('listenAddress')
Finding "listenAddress" in all registered MBean instances ...
/Servers/AdminServer ListenAddress
/Servers/AdminServer/CoherenceMemberConfig/AdminServer UnicastListenAddress null
/Machines/think-x220/NodeManager/think-x220 ListenAddress localhost
/Servers/ms1 ListenAddress
/Servers/ms1/CoherenceMemberConfig/ms1 UnicastListenAddress null
Online & Offline
 Online – connecting to Admin Server over JMX which
in turn updates config.xml etc
 Offline – using WLST libraries that updates config.xml
directly Never connect offline if
the Admin Server is
running!
Online vs Offline
 Pros & Cons:
◦ Offline can do before domain is running, against shared dir from a different server etc
◦ Online has more features available
 If you’re doing a full build you’re probably best doing the base domain
offline to give you enough to start up a secure AdminServer then do the rest
online (IMO!)
 You may want to use WLST scripts/libraries after the domain is live too,
hence good to write for online usage
edit()
startEdit()
PREFIX='WCCPDEV'
NOTE=‘…'
def update_user(DS, SCHEMA, NOTE):
cd('/JDBCSystemResources/'+DS)
cmo.setNotes(NOTE)
cd('JDBCResource/'+DS+'/JDBCDriverParams/'+DS+'/Properties/'+DS+'/Properties/user')
cmo.setValue(SCHEMA)
update_user('mds-CustomPortalDS', PREFIX+‘_MDS', NOTE)
update_user('WebCenter-CustomPortalDS', PREFIX+‘_WEBCENTER', NOTE)
update_user('Activities-CustomPortalDS', PREFIX+‘_ACTIVITIES', NOTE)
activate()
 What is WLST?
 WLST & Management Beans Overview
 Language Features
Print and Concatenation
print ‘Processing ’ + server + ‘...’
Procedures & Libraries
Order is important – procedures/functions must
have been defined before use
Indentation is used to show nesting (not {})
One approach for ‘libraries’ is:
execfile('fmw_utilities.py')
Loops
for I in range(1, 100):
print I
...
While I = ‘something’:
print J
...
Conditions
if <condition> == <value> :
e.g.
if server == ‘AdminServer’:
print ‘Skipping’
else:
print ‘Doing something’
Not a great example –
you wouldn’t usually
test based on name
Parameter Parsing (simple)
 Use argv[n]
import sys
# script takes a single parameter for properties file
try:
loadProperties(sys.argv[1]);
except:
sys.exit('ERROR! Usage: '+sys.argv[0]+' <properties-
file>n');
...
Parameter Parsing (flexible)
 Use getopt
import sys, getopt
def usage():
print "Usage: setup_cluster.py -u adminuser -c
password -t protocol -a adminserver -p port -s start_range
-e number_of_ips_to_check"
Parameter Parsing (flexible – cont.)
try:
opts, args = getopt.getopt(sys.argv[1:],
"u:c:t:a:p:s:e:",["adminuser=", "credential=",
"adminProtocol=", "adminServer=","adminserverPort=",
"startRange=","endRange="])
except:
print “Unknown argument passed"
usage()
sys.exit(2)
Parameter Parsing (flexible – cont.)
for opt, arg in opts:
if opt == "-u":
adminUser = arg
elif opt == "-c":
adminCred = arg
elif opt == "-t":
adminProtocol = arg
...
Passwords / encryption
When you record you’ll get:
setEncrypted('Password', 'Password_456…',
‘…/Script456…Config', ‘…/Script456…Secret')
You probably want something more visible, e.g.
cmo.setPassword( encrypt(APP_PASS,
DOMAIN_BASE+'/'+DOMAIN_NAME) )
cmo.setCustomIdentityKeyStorePassPhraseEncrypted(
encrypt(SSL_IDENTITY_PASS, DOMAIN_BASE+'/'+DOMAIN_NAME) )
Invocation
 CLASS_PATH, esp some layered products
 Slower first time
 Maybe write a cleaner wrapper script of your own
 (If you’re clever you might embed WLST in Java progs)
Tools
 Text editors
◦ vi (of course)
◦ Notepad++ has syntax highlighting for .py by default
◦ Sublime Text has syntax highlighting for .py
 Recently discovered: WLST plug-in with tab/code completion:
https://github.com/Joelith/sublime-wlst
 WLS Console recording function
 Oracle Enterprise Pack for Eclipse
◦ Modern IDE supporting WLST project etc
Questions?
@simon_haslam
My blog: http://simonhaslam.co.uk
http://veriton.com
http://o-box.com

More Related Content

More from Simon Haslam

Platform Provisioning Automation for Oracle Cloud
Platform Provisioning Automation for Oracle CloudPlatform Provisioning Automation for Oracle Cloud
Platform Provisioning Automation for Oracle CloudSimon Haslam
 
Terrraform meet Oracle Cloud: Platform Provisioning Automation
Terrraform meet Oracle Cloud: Platform Provisioning AutomationTerrraform meet Oracle Cloud: Platform Provisioning Automation
Terrraform meet Oracle Cloud: Platform Provisioning AutomationSimon Haslam
 
Delivering Mobile Apps to the Field with Oracle
Delivering Mobile Apps to the Field with OracleDelivering Mobile Apps to the Field with Oracle
Delivering Mobile Apps to the Field with OracleSimon Haslam
 
Provisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack ManagerProvisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack ManagerSimon Haslam
 
Oracle SOA Cloud - Skanska Customer Journey
Oracle SOA Cloud - Skanska Customer JourneyOracle SOA Cloud - Skanska Customer Journey
Oracle SOA Cloud - Skanska Customer JourneySimon Haslam
 
Tips & Tricks for Oracle PaaS Admins
Tips & Tricks for Oracle PaaS AdminsTips & Tricks for Oracle PaaS Admins
Tips & Tricks for Oracle PaaS AdminsSimon Haslam
 
Delivering Mobile Apps to the Field with Oracle JET
Delivering Mobile Apps to the Field with Oracle JETDelivering Mobile Apps to the Field with Oracle JET
Delivering Mobile Apps to the Field with Oracle JETSimon Haslam
 
JET Hybrid Mobile Apps - taster for Oracle CodeOne
JET Hybrid Mobile Apps - taster for Oracle CodeOneJET Hybrid Mobile Apps - taster for Oracle CodeOne
JET Hybrid Mobile Apps - taster for Oracle CodeOneSimon Haslam
 
Delivering Mobile Apps to the field using Oracle
Delivering Mobile Apps to the field using OracleDelivering Mobile Apps to the field using Oracle
Delivering Mobile Apps to the field using OracleSimon Haslam
 
Provisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack ManagerProvisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack ManagerSimon Haslam
 
Connecting Oracle Cloud to your Data Centre (Part A)
Connecting Oracle Cloud to your Data Centre (Part A)Connecting Oracle Cloud to your Data Centre (Part A)
Connecting Oracle Cloud to your Data Centre (Part A)Simon Haslam
 
Running SOA in the Cloud: SOA CS for SOA Suite Customers
Running SOA in the Cloud: SOA CS for SOA Suite CustomersRunning SOA in the Cloud: SOA CS for SOA Suite Customers
Running SOA in the Cloud: SOA CS for SOA Suite CustomersSimon Haslam
 
Tips & Tricks for Java & SOA Cloud Service
Tips & Tricks for Java & SOA Cloud ServiceTips & Tricks for Java & SOA Cloud Service
Tips & Tricks for Java & SOA Cloud ServiceSimon Haslam
 
SOA & WebLogic - Lift & Shift to the Cloud
SOA & WebLogic - Lift & Shift to the CloudSOA & WebLogic - Lift & Shift to the Cloud
SOA & WebLogic - Lift & Shift to the CloudSimon Haslam
 
Driving DevOps for Oracle with the orawls Puppet Modules
Driving DevOps for Oracle with the orawls Puppet ModulesDriving DevOps for Oracle with the orawls Puppet Modules
Driving DevOps for Oracle with the orawls Puppet ModulesSimon Haslam
 
Experiences of SOACS
Experiences of SOACSExperiences of SOACS
Experiences of SOACSSimon Haslam
 
3 Ways to Connect to the Oracle Cloud
3 Ways to Connect to the Oracle Cloud3 Ways to Connect to the Oracle Cloud
3 Ways to Connect to the Oracle CloudSimon Haslam
 
Oracle Traffic Director - a vital part of your Oracle infrastructure
Oracle Traffic Director - a vital part of your Oracle infrastructureOracle Traffic Director - a vital part of your Oracle infrastructure
Oracle Traffic Director - a vital part of your Oracle infrastructureSimon Haslam
 
Java & SOA Cloud Service for Fusion Middleware Administrators
Java & SOA Cloud Service for Fusion Middleware AdministratorsJava & SOA Cloud Service for Fusion Middleware Administrators
Java & SOA Cloud Service for Fusion Middleware AdministratorsSimon Haslam
 

More from Simon Haslam (20)

Platform Provisioning Automation for Oracle Cloud
Platform Provisioning Automation for Oracle CloudPlatform Provisioning Automation for Oracle Cloud
Platform Provisioning Automation for Oracle Cloud
 
Terrraform meet Oracle Cloud: Platform Provisioning Automation
Terrraform meet Oracle Cloud: Platform Provisioning AutomationTerrraform meet Oracle Cloud: Platform Provisioning Automation
Terrraform meet Oracle Cloud: Platform Provisioning Automation
 
Delivering Mobile Apps to the Field with Oracle
Delivering Mobile Apps to the Field with OracleDelivering Mobile Apps to the Field with Oracle
Delivering Mobile Apps to the Field with Oracle
 
Provisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack ManagerProvisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack Manager
 
Oracle SOA Cloud - Skanska Customer Journey
Oracle SOA Cloud - Skanska Customer JourneyOracle SOA Cloud - Skanska Customer Journey
Oracle SOA Cloud - Skanska Customer Journey
 
Tips & Tricks for Oracle PaaS Admins
Tips & Tricks for Oracle PaaS AdminsTips & Tricks for Oracle PaaS Admins
Tips & Tricks for Oracle PaaS Admins
 
Delivering Mobile Apps to the Field with Oracle JET
Delivering Mobile Apps to the Field with Oracle JETDelivering Mobile Apps to the Field with Oracle JET
Delivering Mobile Apps to the Field with Oracle JET
 
JET Hybrid Mobile Apps - taster for Oracle CodeOne
JET Hybrid Mobile Apps - taster for Oracle CodeOneJET Hybrid Mobile Apps - taster for Oracle CodeOne
JET Hybrid Mobile Apps - taster for Oracle CodeOne
 
Delivering Mobile Apps to the field using Oracle
Delivering Mobile Apps to the field using OracleDelivering Mobile Apps to the field using Oracle
Delivering Mobile Apps to the field using Oracle
 
Provisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack ManagerProvisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack Manager
 
Connecting Oracle Cloud to your Data Centre (Part A)
Connecting Oracle Cloud to your Data Centre (Part A)Connecting Oracle Cloud to your Data Centre (Part A)
Connecting Oracle Cloud to your Data Centre (Part A)
 
Running SOA in the Cloud: SOA CS for SOA Suite Customers
Running SOA in the Cloud: SOA CS for SOA Suite CustomersRunning SOA in the Cloud: SOA CS for SOA Suite Customers
Running SOA in the Cloud: SOA CS for SOA Suite Customers
 
Tips & Tricks for Java & SOA Cloud Service
Tips & Tricks for Java & SOA Cloud ServiceTips & Tricks for Java & SOA Cloud Service
Tips & Tricks for Java & SOA Cloud Service
 
SOA & WebLogic - Lift & Shift to the Cloud
SOA & WebLogic - Lift & Shift to the CloudSOA & WebLogic - Lift & Shift to the Cloud
SOA & WebLogic - Lift & Shift to the Cloud
 
Driving DevOps for Oracle with the orawls Puppet Modules
Driving DevOps for Oracle with the orawls Puppet ModulesDriving DevOps for Oracle with the orawls Puppet Modules
Driving DevOps for Oracle with the orawls Puppet Modules
 
Experiences of SOACS
Experiences of SOACSExperiences of SOACS
Experiences of SOACS
 
3 Ways to Connect to the Oracle Cloud
3 Ways to Connect to the Oracle Cloud3 Ways to Connect to the Oracle Cloud
3 Ways to Connect to the Oracle Cloud
 
SSL Everywhere!
SSL Everywhere!SSL Everywhere!
SSL Everywhere!
 
Oracle Traffic Director - a vital part of your Oracle infrastructure
Oracle Traffic Director - a vital part of your Oracle infrastructureOracle Traffic Director - a vital part of your Oracle infrastructure
Oracle Traffic Director - a vital part of your Oracle infrastructure
 
Java & SOA Cloud Service for Fusion Middleware Administrators
Java & SOA Cloud Service for Fusion Middleware AdministratorsJava & SOA Cloud Service for Fusion Middleware Administrators
Java & SOA Cloud Service for Fusion Middleware Administrators
 

Recently uploaded

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 

Recently uploaded (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 

WLST: WebLogic's Swiss Army Knife

  • 2. Simon Haslam Consultant/founder of Veriton & co-founder O-box FMW infra: high availability, security, performance Chair of UKOUG Middleware SIG Middleware focus, but interested from hardware upwards
  • 3.  What is WLST?  WLST & Management Beans Overview  Language Features
  • 4. WLST Overview  Jython = Python running on JVM  JMX are management APIs for Java (implemented as Mbeans)  WLST provides front-end to JMX ◦ a little like ‘SQL*Plus for WebLogic’  Since 12c admin functions possible over RESTful interface WebLogic MBeans Jython WebLogic extensions WLST REST
  • 5. Getting started  Usually connect to Admin Server ‘online’  Run wlst.sh [.cmd] or use Windows short-cut ◦ connect(<username>,<password>,<url>)
  • 6.  What is WLST?  WLST & Management Beans Overview  Language Features
  • 7. Management Beans Overview  All WebLogic servers ◦ Runtime WebLogic MBeans ◦ JVM MBeans  Admin Server only ◦ Domain Runtime MBeans ◦ “edit” MBeans
  • 8. System Change Management  edit()  startEdit()  save()  activate() <= prod. mode releases lock ◦ or undo()  Configuration lock held by user (not tool) so WLST startEdit will show that the domain is being edited in the WLS console
  • 10. easeSyntax() find(‘ListenAddress’); wls:/wls1213test1/serverConfig/Machines/think-x220> find('listenAddress') Finding "listenAddress" in all registered MBean instances ... /Servers/AdminServer ListenAddress /Servers/AdminServer/CoherenceMemberConfig/AdminServer UnicastListenAddress null /Machines/think-x220/NodeManager/think-x220 ListenAddress localhost /Servers/ms1 ListenAddress /Servers/ms1/CoherenceMemberConfig/ms1 UnicastListenAddress null
  • 11. Online & Offline  Online – connecting to Admin Server over JMX which in turn updates config.xml etc  Offline – using WLST libraries that updates config.xml directly Never connect offline if the Admin Server is running!
  • 12. Online vs Offline  Pros & Cons: ◦ Offline can do before domain is running, against shared dir from a different server etc ◦ Online has more features available  If you’re doing a full build you’re probably best doing the base domain offline to give you enough to start up a secure AdminServer then do the rest online (IMO!)  You may want to use WLST scripts/libraries after the domain is live too, hence good to write for online usage
  • 13. edit() startEdit() PREFIX='WCCPDEV' NOTE=‘…' def update_user(DS, SCHEMA, NOTE): cd('/JDBCSystemResources/'+DS) cmo.setNotes(NOTE) cd('JDBCResource/'+DS+'/JDBCDriverParams/'+DS+'/Properties/'+DS+'/Properties/user') cmo.setValue(SCHEMA) update_user('mds-CustomPortalDS', PREFIX+‘_MDS', NOTE) update_user('WebCenter-CustomPortalDS', PREFIX+‘_WEBCENTER', NOTE) update_user('Activities-CustomPortalDS', PREFIX+‘_ACTIVITIES', NOTE) activate()
  • 14.  What is WLST?  WLST & Management Beans Overview  Language Features
  • 15. Print and Concatenation print ‘Processing ’ + server + ‘...’
  • 16. Procedures & Libraries Order is important – procedures/functions must have been defined before use Indentation is used to show nesting (not {}) One approach for ‘libraries’ is: execfile('fmw_utilities.py')
  • 17. Loops for I in range(1, 100): print I ... While I = ‘something’: print J ...
  • 18. Conditions if <condition> == <value> : e.g. if server == ‘AdminServer’: print ‘Skipping’ else: print ‘Doing something’ Not a great example – you wouldn’t usually test based on name
  • 19. Parameter Parsing (simple)  Use argv[n] import sys # script takes a single parameter for properties file try: loadProperties(sys.argv[1]); except: sys.exit('ERROR! Usage: '+sys.argv[0]+' <properties- file>n'); ...
  • 20. Parameter Parsing (flexible)  Use getopt import sys, getopt def usage(): print "Usage: setup_cluster.py -u adminuser -c password -t protocol -a adminserver -p port -s start_range -e number_of_ips_to_check"
  • 21. Parameter Parsing (flexible – cont.) try: opts, args = getopt.getopt(sys.argv[1:], "u:c:t:a:p:s:e:",["adminuser=", "credential=", "adminProtocol=", "adminServer=","adminserverPort=", "startRange=","endRange="]) except: print “Unknown argument passed" usage() sys.exit(2)
  • 22. Parameter Parsing (flexible – cont.) for opt, arg in opts: if opt == "-u": adminUser = arg elif opt == "-c": adminCred = arg elif opt == "-t": adminProtocol = arg ...
  • 23. Passwords / encryption When you record you’ll get: setEncrypted('Password', 'Password_456…', ‘…/Script456…Config', ‘…/Script456…Secret') You probably want something more visible, e.g. cmo.setPassword( encrypt(APP_PASS, DOMAIN_BASE+'/'+DOMAIN_NAME) ) cmo.setCustomIdentityKeyStorePassPhraseEncrypted( encrypt(SSL_IDENTITY_PASS, DOMAIN_BASE+'/'+DOMAIN_NAME) )
  • 24. Invocation  CLASS_PATH, esp some layered products  Slower first time  Maybe write a cleaner wrapper script of your own  (If you’re clever you might embed WLST in Java progs)
  • 25. Tools  Text editors ◦ vi (of course) ◦ Notepad++ has syntax highlighting for .py by default ◦ Sublime Text has syntax highlighting for .py  Recently discovered: WLST plug-in with tab/code completion: https://github.com/Joelith/sublime-wlst  WLS Console recording function  Oracle Enterprise Pack for Eclipse ◦ Modern IDE supporting WLST project etc
  • 26.