06 May 2011

Record in a WLST script the actions performed in Weblogic console


First set some configuration before start recording
Click Preferences,
Select WLST Script Recording,
Select General,
Here you can set
  • the location that the script will be saved (Base Script Directory)
  • the filename (Script File Name)
  • if in each recording will overwrite the previous one or will be appended to the end of file (Append To File)
  • if you must first "Lock & Edit" before start recording (Require Lock)



To start recording 
Click "Lock & Edit"

Select Control

Select Start Recoriding



Alternative you can click Record on top of the page to start recording.

When you finish you click "Stop Recording" to stop the recording.

After the recording is completed, you can find the recording or in the "Recorded commands"
 or in the script saved in the server at the location we defined above.

TROUBLESHOOTING: Exception while trying to execute a recorded session
Error
     [wlst]   File "C:\JDeveloper\mywork\tmp\Set_Complete_Message_Timeout_script.py", line 7, in ?
     [wlst] AttributeError: setFrontendHTTPSPort
     [wlst]
     [wlst] Exception in thread "main" java.lang.IllegalStateException: Traceback (innermost last):
     [wlst]   File "C:\JDeveloper\mywork\tmp\Set_Complete_Message_Timeout_script.py", line 7, in ?
     [wlst] AttributeError: setFrontendHTTPSPort
     [wlst]
     [wlst]     at weblogic.management.scripting.WLSTInterpreterInvoker.printError(WLSTInterpreterInvoker.java:110)
     [wlst]     at weblogic.management.scripting.WLSTInterpreterInvoker.executePyScript(WLSTInterpreterInvoker.java:103)
     [wlst]     at weblogic.management.scripting.WLSTInterpreterInvoker.main(WLSTInterpreterInvoker.java:27)

Reason
Sometimes the recording tool does not record the Node in the Domain Structure were you clicked in order to make your changes. For example if you change the Server "Duration" setting (HTTP Keep Alive) and record you might get something like
eg
startEdit()
cd('/Servers/DefaultServer/WebServer/DefaultServer')
cmo.setKeepAliveSecs(33)
activate()
Beware because sometimes the " cd('/Servers/DefaultServer/WebServer/DefaultServer')" might be missing and only the following might be recorded 
startEdit()
cmo.setKeepAliveSecs(33)
activate()

This will give the Exception mentioned above.

Preparing a recorded script before running
Before  running the recorded script make sure to have the proper cd() commands as mentioned in the TROUBLESHOOTING section.

Finally, in order t connect/disconnent/prepare add the following:


connect('weblogic','weblogic1','t3://localhost:7101')
edit()
startEdit()
cd('/Servers/DefaultServer/WebServer/DefaultServer')
cmo.setKeepAliveSecs(33)
save()
activate()
disconnect()
exit()



Thanx to Serafim for his excellent post (in Greek).


Dig more:

No comments:

Post a Comment

You might also like:

Related Posts Plugin for WordPress, Blogger...