WebLogic Scripting Tool 入門

Download WebLogic Scripting Tool 入門

Post on 22-Nov-2014

11.187 views

Category:

Technology

10 download

Embed Size (px)

DESCRIPTION

WebLogic Server

TRANSCRIPT

  • 1. WebLogic Scripting Tool 2009 5 14
  • 2. OraclePeopleSoftJD EdwardsSiebel Copyright 2009, Oracle. All rights reserved. 2
  • 3. Agenda WebLogic Scripting Tool(WLST) WLST DEMO TIPS Copyright 2009, Oracle. All rights reserved. 3
  • 4. WebLogic Scripting Tool(WLST) WebLogic Server C:>java weblogic.WLST Initializing WebLogic Scripting Tool (WLST) ... wls:/offline> Built on Jython 2.1 100% pure java Python WebLogic Server 9.x Copyright 2009, Oracle. All rights reserved. 4
  • 5. WebLogic Scripting Tool(WLST) WebLogic Server MBean MBean MBean MBean MBean Copyright 2009, Oracle. All rights reserved. 5
  • 6. WebLogic Scripting Tool(WLST) [MBean ServerRuntimeMBean] Copyright 2009, Oracle. All rights reserved. 6
  • 7. WebLogic Scripting Tool(WLST) UNIX MBean serverRuntime, serverConfig..etc MBean ls / cd ls MBean cd MBean Copyright 2009, Oracle. All rights reserved. 7
  • 8. WebLogic Scripting Tool(WLST) [WLST ServerRuntimeMBean] Copyright 2009, Oracle. All rights reserved. 8
  • 9. WebLogic Scripting Tool(WLST) 100% pure java Python > a = 5 + 10 > print a > def func(arg): > return Hello, + arg Copyright 2009, Oracle. All rights reserved. 9
  • 10. WebLogic Scripting Tool(WLST) Java from java.lang import * (WLST ) import javax.swing as swing str = String(Test String) print System.currentTimeMillis() Copyright 2009, Oracle. All rights reserved. 10
  • 11. WLST java weblogic.WLST -i XXX.py weblogic.management.scripting.utils.WLSTInterpreter weblogic.WLST java weblogic.WLST XXXX.py Copyright 2009, Oracle. All rights reserved. 11
  • 12. Current Management Object cmo = MBean serverRuntime() cmo = ServerRuntimeMBean MBean API cmo.shutdown() cmo.getState() sruntime = cmo sruntime.getState() Copyright 2009, Oracle. All rights reserved. 12
  • 13. Python - 1 > name = (taro, jiro) > print Hello %s and %s % name > import time > time.sleep(5) > f = open(c:/temp/test.txt', 'w') > f.write(quot;hellonquot;) > f.close() > name = raw_input(your name? ) Copyright 2009, Oracle. All rights reserved. 13
  • 14. Python - 2 > for i in range(1,10): > print i > import time > time.strftime('%Y-%m-%d %H:%M:%S') > string.atoi(5) > str(5) > dir(time) Copyright 2009, Oracle. All rights reserved. 14
  • 15. WLST startRecording(c:/temp/record.py) stopRecording() WLST [ WLST ] Copyright 2009, Oracle. All rights reserved. 15
  • 16. WebLogic Server [ThreadMonitor.py] # ThreadPoolRuntimeMbean def getThreadPoolInf(threadPoolRuntime): # oExecuteThreadTotalCount = threadPoolRuntime.getExecuteThreadTotalCount() # oExecuteThreadIdleCount = threadPoolRuntime.getExecuteThreadIdleCount() # STANDBY oStandbyThreadCount = threadPoolRuntime.getStandbyThreadCount() # ACTIVE oRunActiveThread = oExecuteThreadTotalCount-oExecuteThreadIdleCount-oStandbyThreadCount head = quot;----------[quot; + time.strftime('%Y-%m-%d %H:%M:%S') + quot;]----------quot; sExecuteThreadTotalCount = quot;ExecuteThreadTotalCount : quot; + str(oExecuteThreadTotalCount) sExecuteThreadIdleCount = quot;ExecuteThreadIdleCount : quot; + str(oExecuteThreadIdleCount) sStandbyThreadCount = quot;StandbyThreadCount : quot; + str(oStandbyThreadCount) sRunActiveThrea = quot;RunActiveThread : quot; + str(oRunActiveThread) # return [head,sExecuteThreadTotalCount,sExecuteThreadIdleCount,sStandbyThreadCount,sRunActiveThrea] Copyright 2009, Oracle. All rights reserved. 16
  • 17. WebLogic Server # def outputFile(oList): # f = open('c:/temp/test.txt', 'a') # for i in range(0,len(oThreadRuntimeInf)): f.write(oList[i] + quot;nquot;) f.close() # WebLogic Server connect('weblogic','weblogic','t3://localhost:7001') # Python time import time # Python traceback import traceback # ServerRuntimeMbean serverRuntime() # ThreadPoolRuntimeMbean oThreadPoolRuntime = getMBean('ThreadPoolRuntime/ThreadPoolRuntime') Copyright 2009, Oracle. All rights reserved. 17
  • 18. WebLogic Server while(true): try: # ThreadPoolRuntimeMbean oThreadRuntimeInf = getThreadPoolInf(oThreadPoolRuntime) # ThreadPoolRuntimeMbean for i in range(0,len(oThreadRuntimeInf)): print oThreadRuntimeInf[i] # ThreadPoolRuntimeMbean outputFile(oThreadRuntimeInf) # 5 time.sleep(5) except: # print quot;quot; traceback.print_exc() break Copyright 2009, Oracle. All rights reserved. 18
  • 19. DEMO WebLogic Server WebLogic Server Deploy JMS GUI Copyright 2009, Oracle. All rights reserved. 19
  • 20. TIPS prompt() find() MBean jndi() JNDI help() Copyright 2009, Oracle. All rights reserved. 20
  • 21. WebLogic Scripting Tool http://otndnld.oracle.co.jp/document/products/wls/docs10 3/config_scripting/using_WLST.html WLST http://otndnld.oracle.co.jp/document/products/wls/docs10 3/ConsoleHelp/taskhelp/console/RecordWLSTScripts.html BEA WebLogic Server 9.x/10 () BEA () Python Jython () () Copyright 2009, Oracle. All rights reserved. 21
  • 22. Copyright 2009, Oracle. All rights reserved. 22

Recommended

View more >