{"id":16464,"date":"2021-06-14T17:11:10","date_gmt":"2021-06-14T15:11:10","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/"},"modified":"2025-10-24T09:38:46","modified_gmt":"2025-10-24T07:38:46","slug":"customizing-oracle-weblogic-wlst","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/","title":{"rendered":"Customizing Oracle WebLogic wlst"},"content":{"rendered":"<p>As stated in Oracle&#8217;s <a href=\"https:\/\/docs.oracle.com\/cd\/E13222_01\/wls\/docs90\/config_scripting\/using_WLST.html#1082301\">documentation<\/a>, the WebLogic Scripting Tool, or wlst for short, can be extended by adding functions in 2 non mutually exclusive places:<\/p>\n<ol>\n<li>any file located in $WL_HOME\/common\/wlst<\/li>\n<li>any file located in $WL_HOME\/common\/wlst\/lib\/<\/li>\n<\/ol>\n<p>Files must have the .py extension and will be automatically loaded by wlst when it starts.<br \/>\nIn the first alternative, the script files will be included in the current wlst session&#8217;s namespace and can directly be invoked by their name. In the second alternative, they will be imported into their own namespace, which is the name of the file without the extension, and need to be prefixed with it when invoked.<\/p>\n<p>Customizations consist in writting jython functions. Depending on the version of WebLogic in use, wlst is based on jython 2.2.1 (up to WebLogic 12.2.x) or jython 2.7.1 (from WebLogic 14.4.1 onwards), the latter being the final 2.x jython release, with a version 3.x on the drawing board. As you can see, jython lags considerably behind python which is currently at release 3.9.5 with 3.10 due later this year. However, jython is largely suitable for the usual administrative tasks in WebLogic, and one should not forget that java is not far away for those more demanding tasks.<\/p>\n<p>One thing that is particularly boring with wlst is that all the commands are jython&#8217;s functions that get invoked; this is why one needs to include the () suffix, which is the function call operator. When one would like to type cd \/AdminConsole (like in the wlshell of yore, or in the bash shell), one must type cd(&#8216;\/AdminConsole&#8217;) instead, with parentheses and quotes, pretty clumsy.<br \/>\nOK, but what about print ? In jython 2.x, print is still a statement like if, def, for, etc, and not a function yet. It&#8217;ll become one starting in jython 3.x, just like in python, and its syntax will change accordingly for the best or the worse.<br \/>\nIn order to suppress the function call operator (), the language itself would need to be modified to introduce new statements in the grammar. Needless to say, this is a bit too geeky for a blog like this.<\/p>\n<h2>A few examples<\/h2>\n<p>In order to demonstrate the customization, I&#8217;ll propose to start with a few very trivial yet useful functions:<\/p>\n<pre class=\"brush: python; gutter: true; first-line: 1; highlight: [1,12,18,24,30,36,42,48,54,60,66,72,89,98,108,114]\">\ndef show_output(on_or_off = True):\n   \"\"\"\nEnable (on_or_off == True) or disable (on_or_off == False) the output on the terminal;\nNote that only the output from java is disabled, i.e. for all the wlst's predefined commands, not the jython's print statement;\n   \"\"\"\n   global saved_out\n   if on_or_off:\n      stopRedirect()\n   else:\n      redirect('\/dev\/null', 'false')\n\ndef ch():\n   \"\"\"\nchange the current directory to \/;\n   \"\"\"\n   cd('\/')\n\ndef lc(path = None):\n   \"\"\"\nlist the mbeans and their properties from the optional path or from the current directory is path is omitted;\n   \"\"\"\n   ls('c', path)\n\ndef la(path = None):\n   \"\"\"\nlist only the mbeans' properties from the optional path or from the current directory is path is omitted;\n   \"\"\"\n   ls('a', path)\n\ndef lo(path = None):\n   \"\"\"\nlist only the mbeans from the optional path or from the current directory is path is omitted;\n   \"\"\"\n   ls('o', path)\n\ndef ll(path = None):\n   \"\"\"\nsame as lc(), only more natural as it matches the Unix ls -l command;\n   \"\"\"\n   ls(path)\n\ndef lh():\n   \"\"\"\nsame as ls() but for the hierarchy's root;\n   \"\"\"\n   ls('\/')\n\ndef lch(path = '\/'):\n   \"\"\"\nsame as lc() but the default path is the hierarchy's root instead of the current directory;\n   \"\"\"\n   ls('c', path)\n\ndef lah(path = '\/'):\n   \"\"\"\nsame as la() but the default path is the hierarchy's root instead of the current directory;\n   \"\"\"\n   ls('a', path)\n\ndef loh(path = '\/'):\n   \"\"\"\nsame as lo() but the default path is the hierarchy's root instead of the current directory;\n   \"\"\"\n   ls('o', path)\n\ndef llh(path = '\/'):\n   \"\"\"\nsame as ll() but the default path is the hierarchy's root instead of the current directory;\n   \"\"\"\n   ls(path)\n\ndef ld(path = None):\n   \"\"\"\nAn attempt at reducing the output on the terminal like when using the * wildcard;\nbehaves like lc() if no path is given, otherwise ls() all the mbeans that start with path, i.e. functionally ls('*' + path + '*');\n   \"\"\"\n   if path == None:\n      lc()\n   else:\n      try:\n         show_output(False)\n         for d in ls('c').split('n'):\n            if d[7 :].find(path) &gt; -1: print d\n      finally:\n         # make sure the output is restored;\n         show_output(True)\n\ncurrent_path = []\ndef push(path):\n   \"\"\"\nmove to directory path after having saved the current one on the stack;\nsimilar to Linux push command;\n   \"\"\"\n   global current_path\n   current_path.append(pwd())\n   cd(path)\n\ndef pop():\n   \"\"\"\nmove back to the preceding directory on top of the stack;\nsilently ignore the command if already at the top;\n   \"\"\"\n   try:\n      cd(current_path.pop())\n   except:\n      pass\n\ndef b():\n   \"\"\"\nmove one level up the mbean hierarchy;\n   \"\"\"\n   cd('..')\n\ndef conn():\n   \"\"\"\nconnect to the local administation server on the canonical port;\nuseful when developing and the cleartext password is not a problem;\n   \"\"\"\n   connect('weblogic', 'welcome1', 't3:\/\/localhost:7001')\n<\/pre>\n<p>Function show_output() defined on line 1 is for internal use only as it does not make much sense when interacting in wlst.<br \/>\nFunction names are quite mnenonic, e.g. ch() for change to home directory, lc() for ls(&#8216;c&#8217;), ll() like in Unix ls -l (i.e. full listing, same as ls(&#8216;c&#8217;), lh() for ls(&#8216;\/&#8217;), and so on with the l*h() functions where the default path is home &#8216;\/&#8217;.<br \/>\nld() is more interesting in that it attempts at simulating the * wildcard, which is not supported in wlst. When the optional path is given, it lists all the directories that contain path, just like if one had typed &#8216;ls -l *&lt;path&gt;*&#8217;, examples:<\/p>\n<pre class=\"brush: python; gutter: true; first-line: 1; highlight: [1,28,34]\">\nwls:\/webcenter\/serverConfig\/&gt; ls()\ndr--   AdminConsole\n...\ndr--   JDBCStores\ndr--   JDBCSystemResources\ndr--   JMSBridgeDestinations\ndr--   JMSInteropModules\ndr--   JMSServers\ndr--   JMSSystemResources\n...\ndr--   ManagedExecutorServiceTemplates\ndr--   ManagedExecutorServices\ndr--   ManagedScheduledExecutorServiceTemplates\n...\ndr--   ManagedThreadFactories\ndr--   ManagedThreadFactoryTemplates\n...\ndr--   ResourceGroupTemplates\n...\ndr--   ServerTemplates\n...\n-r--   AdminServerName                              AdminServer\n...\n-r--   MaxConcurrentNewThreads                      50\n...\n\n# list all the entries that contain Thread;\nwls:\/webcenter\/serverConfig\/&gt; ld('Thread')\ndr--   ManagedThreadFactories   \ndr--   ManagedThreadFactoryTemplates    \n-r--   MaxConcurrentNewThreads                      50   \n\n# list all the entries that contain Template;\nwls:\/webcenter\/serverConfig\/&gt; ld('Template')\ndr--   ManagedExecutorServiceTemplates   \ndr--   ManagedScheduledExecutorServiceTemplates   \ndr--   ManagedThreadFactoryTemplates   \ndr--   ResourceGroupTemplates   \ndr--   ServerTemplates   \n<\/pre>\n<p>One can easily imagine to add support for much more sophisticated wildcards here if need be.<\/p>\n<h2>A more complex customization example<\/h2>\n<p>In <a href=\"https:\/\/www.dbi-services.com\/blog\/?p=50173&amp;preview=true\">A web-based MBean Navigator for Oracle WebLogic wlst<\/a>, I presented an utility that wraps wlst&#8217;s navigation commands&#8217;output into an HTML page for visualization in a browser, with optional recursion. The job was done by essentially 2 functions: list_dir() and sweep_dir(). Let&#8217;s make them available to wlst as well.<\/p>\n<pre class=\"brush: python; gutter: true; first-line: 1; highlight: [1,11,48,78,123]\">\ntrees = ['custom', 'domainConfig', 'domainCustom', 'domainRuntime', 'edit', 'editCustom', 'jndi', 'runtime', 'serverConfig', 'serverRuntime']\n \ndef clean_mbean_name(mbean_name):\n   \"\"\"\nremove the [....] part of the mbean name;\n   \"\"\"\n   mbean_name = str(mbean_name)\n   return mbean_name[mbean_name.find(']') + 1 :]\n \nimport traceback\ndef list_dir(path = None, show_output = True):\n   \"\"\"\n   return a list of dictionaries, one for each  entries in directory path, e.g.:\n      [\n         {'is_directory': True, 'name': u'mydomain', 'value': None, 'path_name': '\/AdminConsole\/', 'value': '....' | None, 'mbean_name': '....' | None}\n         ...\n      ]\n   if the optional path is omitted, it defaults to the current directory;\n   \"\"\"\n   entries = []\n   saved_path = pwd()\n   if path != None:\n      try:\n         cd(path)\n         path = pwd()\n      except:\n         dumpStack()\n         traceback.print_exc()\n\n      # remove the drive part from the path, i.e. the active tree name;\n      for t in trees:\n         if 0 == path.find(t + ':'):\n            path = path[path.find(':') + 1:]\n            break\n   else:\n      path = pwd()\n \n   # remove the drive part from the path, i.e. the active tree name;\n   for t in trees:\n      if 0 == path.find(t + ':'):\n         path = path[path.find(':') + 1:]\n         break\n \n   print(path)\n   current_mbean = clean_mbean_name(getMBean(path))\n   try:\n      cd(path)\n      for p in ls().split('n'):\n         if not p:\n            continue\n         p = p.strip()\n         if \"\" == p:\n            continue\n         if p[0] not in (\"d\", \"-\"):\n            # continuation of previous value;\n            entries[-1]['value'] += p\n            continue\n         if 'd' == p[0]:\n            entry = {'is_directory': True, 'path_name': path, 'name': p[7:], 'value': None}\n            entry['mbean_name'] = clean_mbean_name(getMBean(path + ('\/' if '\/' != path else '') + entry['name']))\n         elif -1 == p.find(' ', 7):\n            entry = {'is_directory': False, 'path_name': path, 'name': p[7:], 'value': None, 'mbean_name': None}\n         else:\n            entry = {'is_directory': False, 'path_name': path, 'name': p[7:p.find(' ', 7)], 'value': p[p.find(' ', 7):].strip(), 'mbean_name': None}\n         entries.append(entry)\n \n         if entry['is_directory']:\n            current_mbean = clean_mbean_name(getMBean(path + \"\/\" + entry['name']))\n   except:\n      dumpStack()\n      traceback.print_exc()\n \n   cd(saved_path)\n   return (entries, path)\n  \n# needed because we need the set() constructor but it is overriden by wlst;\nimport __builtin__\ndef sweep_dir(path, (cumul, visited) = (None, None)):\n   \"\"\"\n   recursively, breadth-first lists path content and return a list of raw entries;\n   path is a clean path string, e.g. \/AdminServer;\n   an attempt at preventing infinite recursion is done but there is a risk that some entries are missed;\n   \"\"\"\n   if (cumul, visited) == (None, None):\n      (cumul, visited) = ([],  __builtin__.set())\n   try:\n      temp_ls, path = list_dir(path) #, False)\n   except:\n      print('exception in sweep_dir()')\n      dumpStack()\n      traceback.print_exc()\n      print(404, \"error while listing directory \" + path + \", ignoring request ...\")\n      return None\n \n   current_mbean = clean_mbean_name(getMBean(path))\n \n   # display attributes first so they are grouped together right below their parent directory;\n   try:\n      for p in temp_ls:\n         if p['is_directory']:\n            continue\n         cumul.append(p)\n \n      # display the sub-directories now;\n      for p in temp_ls:\n         if not p['is_directory']:\n            continue\n         cumul.append(p)\n    \n         for p in temp_ls:\n            if p['is_directory']:\n               if p['mbean_name'] != current_mbean and p['mbean_name'] in visited:\n                  print('(' + p['name'] + ')')\n                  continue\n               else:\n                  visited.add(p['mbean_name'])\n                  sweep_dir(path + ('\/' if '\/' != path[-1] else '') + p['name'], (cumul, visited))\n   except:\n      dumpStack()\n      traceback.print_exc()\n   return cumul\n\ndef lsR(path):\n   \"\"\"\nwrapper around sweep_dir() with a more familiar name similar to the Unix command ls -R;\n   \"\"\"\n   start_time = System.currentTimeMillis()\n   result = sweep_dir(path)\n   end_time = System.currentTimeMillis()\n   print(\"%10.1f seconds elapsed\" % ((end_time - start_time)\/1000))\n   return result\n<\/pre>\n<p>Line 1 defines the different hierachies, or trees, it is possible to navigate in. By just typing &#8220;trees&#8221; in wlst, one can display that list and subsequently move through the trees by calling the eponym function, e.g.:<\/p>\n<pre class=\"brush: python; gutter: true; first-line: 1; highlight: []\">\n# display the trees;\nwls:\/webcenter\/serverConfig\/&gt; trees\n['custom', 'domainConfig', 'domainCustom', 'domainRuntime', 'edit', 'editCustom', 'jndi', 'runtime', 'serverConfig', 'serverRuntime']\n\n# move to the jndi hierarchy;\nwls:\/webcenter\/serverConfig\/&gt; jndi()\nLocation changed to jndi tree. This is a read-only tree with No root. \nFor more help, use help('jndi')\n\n# move to the runtime tree;\nwls:\/webcenter\/jndi\/&gt; runtime()\nCannot change to \"runtime\" tree because the compatibility MBeanServer is no longer supported.\n\n# in effect, it is obsoleted starting in 14.x;\n# use serverRuntime() insteed;\nwls:\/webcenter\/jndi\/&gt; serverRuntime()\n\n# back to the default serverConfig tree;\nwls:\/webcenter\/serverRuntime\/&gt; serverConfig()\n<\/pre>\n<p>Both list_dir() and sweep_dir() can be called directly and output wlst&#8217;s ls() result invoked on line 47. However, the latter has a wrapper, lsR() defined on line 122, that adds timing info. Typically, such things are done more pythonically with reusable decorators but this is the only place where it would be used so let&#8217;s keep things simple.<br \/>\nIn addition, both functions returns the directory entries in a list of dictionaries, which can be further processed interactively in the wlst shell.<br \/>\nHere is an example:<\/p>\n<pre class=\"brush: python; gutter: true; first-line: 1; highlight: []\">\n# in wlst;\nwls:\/webcenter\/serverConfig\/&gt; a = lsR('CoherenceClusterSystemResources')\n\/CoherenceClusterSystemResources\ndr--   defaultCoherenceCluster\n\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\ndr--   CoherenceCacheConfigs\ndr--   CoherenceClusterResource\ndr--   Resource\ndr--   SubDeployments\ndr--   Targets\n\n-r--   CompatibilityName                            null\n-r--   CustomClusterConfigurationFileName           null\n-r--   DeploymentOrder                              100\n...\n...\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets\ndr--   IBR_server1\ndr--   UCM_server1\ndr--   WC_Portal\n\n(IBR_server1)\n(UCM_server1)\n(WC_Portal)\n(IBR_server1)\n(UCM_server1)\n(WC_Portal)\n(IBR_server1)\n(UCM_server1)\n(WC_Portal)\n     102.0 seconds elapsed\n\n# where parenthesized entries mean that they have already been visited earlier;\n# display a;\nwls:\/webcenter\/serverConfig\/&gt; a\n[{'is_directory': True, 'mbean_name': 'com.bea:Name=defaultCoherenceCluster,Type=CoherenceClusterSystemResource', 'name': u'defaultCoherenceCluster', 'value': None,\n 'path_name': u'\/CoherenceClusterSystemResources'}, {'is_directory': False, 'mbean_name': None, 'name': u'CompatibilityName', 'value': u'null', 'path_name':\n u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'CustomClusterConfigurationFileName', 'value': u'null',\n 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'DeploymentOrder', 'value': u'100', \n'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'DeploymentPrincipalName', 'value': u'null', \n'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'DescriptorFileName', 'value': \nu'coherence\/defaultCoherenceCluster-coherence.xml', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, \n'name': u'DynamicallyCreated', 'value': u'false', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': \nu'Id', 'value': u'0', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'ModuleType', 'value': \nu'null', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'Name', 'value': \nu'defaultCoherenceCluster', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'Notes', 'value': \nu'null', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'ReportGroupFile', 'value': \nu'em\/metadata\/reports\/coherence\/report-group.xml', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, \n'name': u'SourcePath', 'value': u'.\/config\/coherence\/defaultCoherenceCluster-coherence.xml', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, \n{'is_directory': False, 'mbean_name': None, 'name': u'Tags', 'value': u'null', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': \nFalse, 'mbean_name': None, 'name': u'Type', 'value': u'CoherenceClusterSystemResource', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, \n{'is_directory': False, 'mbean_name': None, 'name': u'UsingCustomClusterConfigurationFile', 'value': u'false', 'path_name': u'\/CoherenceClusterSystemResources\n\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'freezeCurrentValue', 'value': u'Void : String(attributeName)', 'path_name': \nu'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'getInheritedProperties', 'value': u'String[] : String[]\n(propertyNames)', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': \nu'importCustomClusterConfigurationFile', 'value': u'Void : String(file)', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': False, \n'mbean_name': None, 'name': u'isInherited', 'value': u'Boolean : String(propertyName)', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, \n{'is_directory': False, 'mbean_name': None, 'name': u'isSet', 'value': u'Boolean : String(propertyName)', 'path_name': u'\/CoherenceClusterSystemResources\ndefaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'unSet', 'value': u'Void : String(propertyName)', 'path_name': \nu'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': True, 'mbean_name': 'com.bea:Name=defaultCoherenceCluster,Type=CoherenceClusterSystemResource', \n'name': u'CoherenceCacheConfigs', 'value': None, 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster'}, {'is_directory': True, 'mbean_name': \n'com.bea:Name=defaultCoherenceCluster,Type=weblogic.coherence.descriptor.wl.WeblogicCoherenceBean,Parent=\n[webcenter]\/CoherenceClusterSystemResources[defaultCoherenceCluster],Path=CoherenceClusterResource[defaultCoherenceCluster]', 'name': u'defaultCoherenceCluster', 'value': None, \n'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource'}, {'is_directory': False, 'mbean_name': None, 'name': \nu'CustomClusterConfigurationFileLastUpdatedTimestamp', 'value': u'0', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\n\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'CustomClusterConfigurationFileName', 'value': u'null', 'path_name': \nu'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'Name', \n'value': u'defaultCoherenceCluster', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster'}, \n{'is_directory': False, 'mbean_name': None, 'name': u'Version', 'value': u'null', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\n\/CoherenceClusterResource\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'isSet', 'value': u'Boolean : String(propertyName)', 'path_name': \nu'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster'}, {'is_directory': False, 'mbean_name': None, 'name': u'unSet', \n'value': u'Void : String(propertyName)', 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster'}, \n{'is_directory': True, 'mbean_name': 'com.bea:Name=defaultCoherenceCluster,Type=weblogic.coherence.descriptor.wl.WeblogicCoherenceBean,Parent=\n[webcenter]\/CoherenceClusterSystemResources[defaultCoherenceCluster],Path=CoherenceClusterResource[defaultCoherenceCluster]', 'name': u'CoherenceAddressProviders', 'value': \nNone, 'path_name': u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster'}, {'is_directory': True, 'mbean_name': \n'com.bea:Name=defaultCoherenceCluster,Type=weblogic.coherence.descriptor.wl.CoherenceAddressProvidersBean,Parent=\n[webcenter]\/CoherenceClusterSystemResources[defaultCoherenceCluster],Path=\n...\n...\n\n# how many entries found ?\nwls:\/webcenter\/serverConfig\/&gt; len(a)\n5209\n\n# display all the mbeans' full path;\nwls:\/webcenter\/serverConfig\/&gt; for e in a:\n...   if e['is_directory']:\n...      print e['path_name'] + '\/' + e['name']\n\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceCacheConfigs\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster\/CoherenceAddressProviders\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster\/CoherenceAddressProviders\/defaultCoherenceCluster\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster\/CoherenceAddressProviders\/defaultCoherenceCluster\/CoherenceAddressProviders\n...\n\n# as some mbeans are referenced from several places, filter out the duplicated entries;\nwls:\/webcenter\/serverConfig\/&gt; uniq=__builtin__.set()\nwls:\/webcenter\/serverConfig\/&gt; for e in a:\n...   if e['is_directory']:\n...      uniq.add(e['path_name'] + '\/' + e['name'])\n...\nwls:\/webcenter\/serverConfig\/&gt; len(uniq)\n261\n\n# show the unique mbeans entries;\nwls:\/webcenter\/serverConfig\/&gt; uniq\nset([u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets', u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets\/IBR_server1\/SingleSignOnServices',\n u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets\/WC_Portal\/WebService\/WC_Portal\/WebServiceBuffering\/WC_Portal', u'\/CoherenceClusterSystemResources\n\/defaultCoherenceCluster\/Targets\/IBR_server1\/DataSource\/IBR_server1\/Targets', u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets\/WC_Portal\/WebService\/WC_Portal\n\/WebServiceBuffering\/WC_Portal\/WebServiceRequestBufferingQueue', u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets\/WC_Portal\/IIOP\/WC_Portal', \nu'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets\/IBR_server1\/DefaultFileStore', u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets\/UCM_server1\n\/ConfigurationProperties', u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets\/IBR_server1\/CoherenceMemberConfig\/IBR_server1', u'\/CoherenceClusterSystemResources\n\/defaultCoherenceCluster\/Targets\/WC_Portal\/Cluster', u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets\/UCM_server1\/XMLRegistry', \nu'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets\/UCM_server1', u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets\/IBR_server1\/DataSource\n\/IBR_server1\/DataSourceLogFile', u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster\/CoherenceClusterParams\n\/defaultCoherenceCluster\/CoherenceServices', u'\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/Targets\/WC_Portal\/WebService\n...\n...\n\n# nicer, sorted output;\nwls:\/webcenter\/serverConfig\/&gt; for e in sorted(uniq):\n... print e\n...\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceCacheConfigs\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster\/CoherenceAddressProviders\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster\/CoherenceAddressProviders\/defaultCoherenceCluster\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster\/CoherenceAddressProviders\/defaultCoherenceCluster\/CoherenceAddressProviders\n\/CoherenceClusterSystemResources\/defaultCoherenceCluster\/CoherenceClusterResource\/defaultCoherenceCluster\/CoherenceClusterParams\n...\n\n# etc...\n<\/pre>\n<p>All that interactive work can be done without re-scanning the tree, a valuable time saving.<\/p>\n<h2>Conclusion<\/h2>\n<p>It is very easy to build oneself a list of frequently used functions that can be loaded each time wlst starts. As they can be written in jython using the wlst command-line API, those customizations can be as sophisticated as needed. For more special cases, dedicated namespaces can be introduced in order to separate different implementations of the same functions, e.g. by domains. I hope you enjoyed this article and that it will be useful to you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As stated in Oracle&#8217;s documentation, the WebLogic Scripting Tool, or wlst for short, can be extended by adding functions in 2 non mutually exclusive places: any file located in $WL_HOME\/common\/wlst any file located in $WL_HOME\/common\/wlst\/lib\/ Files must have the .py extension and will be automatically loaded by wlst when it starts. In the first alternative, [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[2352],"type_dbi":[],"class_list":["post-16464","post","type-post","status-publish","format-standard","hentry","category-application-integration-middleware","tag-weblogic-wlst-jython"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Customizing Oracle WebLogic wlst - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Customizing Oracle WebLogic wlst\" \/>\n<meta property=\"og:description\" content=\"As stated in Oracle&#8217;s documentation, the WebLogic Scripting Tool, or wlst for short, can be extended by adding functions in 2 non mutually exclusive places: any file located in $WL_HOME\/common\/wlst any file located in $WL_HOME\/common\/wlst\/lib\/ Files must have the .py extension and will be automatically loaded by wlst when it starts. In the first alternative, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-14T15:11:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-24T07:38:46+00:00\" \/>\n<meta name=\"author\" content=\"Middleware Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Middleware Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/\"},\"author\":{\"name\":\"Middleware Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\"},\"headline\":\"Customizing Oracle WebLogic wlst\",\"datePublished\":\"2021-06-14T15:11:10+00:00\",\"dateModified\":\"2025-10-24T07:38:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/\"},\"wordCount\":787,\"commentCount\":0,\"keywords\":[\"WebLogic wlst jython\"],\"articleSection\":[\"Application integration &amp; Middleware\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/\",\"name\":\"Customizing Oracle WebLogic wlst - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2021-06-14T15:11:10+00:00\",\"dateModified\":\"2025-10-24T07:38:46+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Customizing Oracle WebLogic wlst\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\",\"name\":\"Middleware Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"caption\":\"Middleware Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/middleware-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Customizing Oracle WebLogic wlst - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/","og_locale":"en_US","og_type":"article","og_title":"Customizing Oracle WebLogic wlst","og_description":"As stated in Oracle&#8217;s documentation, the WebLogic Scripting Tool, or wlst for short, can be extended by adding functions in 2 non mutually exclusive places: any file located in $WL_HOME\/common\/wlst any file located in $WL_HOME\/common\/wlst\/lib\/ Files must have the .py extension and will be automatically loaded by wlst when it starts. In the first alternative, [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/","og_site_name":"dbi Blog","article_published_time":"2021-06-14T15:11:10+00:00","article_modified_time":"2025-10-24T07:38:46+00:00","author":"Middleware Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Middleware Team","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/"},"author":{"name":"Middleware Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1"},"headline":"Customizing Oracle WebLogic wlst","datePublished":"2021-06-14T15:11:10+00:00","dateModified":"2025-10-24T07:38:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/"},"wordCount":787,"commentCount":0,"keywords":["WebLogic wlst jython"],"articleSection":["Application integration &amp; Middleware"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/","url":"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/","name":"Customizing Oracle WebLogic wlst - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2021-06-14T15:11:10+00:00","dateModified":"2025-10-24T07:38:46+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/customizing-oracle-weblogic-wlst\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Customizing Oracle WebLogic wlst"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1","name":"Middleware Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","caption":"Middleware Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/middleware-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/16464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=16464"}],"version-history":[{"count":1,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/16464\/revisions"}],"predecessor-version":[{"id":41205,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/16464\/revisions\/41205"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=16464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=16464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=16464"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=16464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}