Hi,

Jay SenSharma

Jay SenSharma

Here is a Simple Ant Script which internally uses the WLST AntTask …using this ANT Developers can easily utilize the WLST scripting features in their own ANT scripts.  (Just Make sure that the Indentation is correct while Typing your WLST snippet inside the <script> Tag…

The following Ant Script will demonstrate that how we can get the Name and the ListenAddress Port Details of all the Servers available in our Domain…

WLST Script To Get Server Details

WLST Script To Get Server Details

To run above “build.xml” file you need to run the “. ./setWLSEnv.sh” in the Shell prompt first sothat the CLASSPATH & PATH will be set…

ant

——————————–

OUTPUT:
C:JavaTestWLST_ANT>ant
Buildfile: build.xml

getServerDetails:
[wlst] <WLSTTask> All lines will be trimmed by 7
[wlst] <WLSTTask> The script that will be executed
[wlst] print ‘Connecting to WebLogic AdminServer…’
[wlst] connect(‘weblogic’,’weblogic’,’t3://localhost:7001′)
[wlst] svrs = cmo.getServers()
[wlst] print ‘Servers in the domain are’
[wlst] for x in svrs:
[wlst]       print x.getName()
[wlst]       print x.getListenPort()
[wlst]       print x.getListenAddress()
[wlst]       print ‘———————‘

[wlst] In the target loop
[wlst] Connecting to t3://localhost:7001 with userid weblogic …
[wlst] Successfully connected to Admin Server ‘AdminServer’ that belongs to domain ‘base_domain’.
[wlst]
[wlst] Warning: An insecure protocol was used to connect to the
[wlst] server. To ensure on-the-wire security, the SSL port or
[wlst] Admin port should be used instead.

[wlst] Servers in the domain are
[wlst] AdminServer
[wlst] 7001

[wlst] ———————
[wlst] MS1
[wlst] 7003

[wlst] ———————
[wlst] MS-2
[wlst] 7005

[wlst] ———————

BUILD SUCCESSFUL
Total time: 2 seconds

If you enjoyed this post, please considerleaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.