简体   繁体   English

如何通过.py文件运行wlst脚本

[英]How to run wlst script by .py file

I'm trying to run wlst script form .py file but it can not be done 我正在尝试运行wlst脚本表单.py文件,但无法完成

Content of .py file : .py文件的内容:

connect('weblogic','weblogic','t3://localhost:8001')
sca_undeployComposite('http://localhost:8001','Hello','1.0','user='weblogic',partition='myPartition')
sca_deletePartition('myPartition')
sca_createPartition('myPartition')
sca_deployComposite('http://localhost:8001','C:\WLST\Test\Application.zip',user='weblogic',configplan='myPlan.xml', partition='myPartition')
exit()

when i run cmd file to execute script, Only connect() method is execute success. 当我运行cmd文件来执行脚本时,只有connect()方法执行成功。 any command bellow it can not be execute. 任何命令,它都无法执行。 And error message appear: Problem invoking WLST - Traceback (innermost last): File "c:\\WLS\\script\\filname.py", line 2, in ? 并出现错误消息:调用WLST的问题 - 回溯(最里面的最后一个):文件“c:\\ WLS \\ script \\ filname.py”,第2行,在? Name Error: sca_undeployComposite 名称错误:sca_undeployComposite

Please help me to resolve it. 请帮我解决一下。 Thanks ! 谢谢 !

The commands after the connect() line which are not regular WLST commands. connect()行之后的命令不是常规的WLST命令。 They requires sca related libraries into CLASSPATH. 它们需要sca相关的库进入CLASSPATH。 if you look into your wlst.cmd or .sh file that is actually calling the environment setup file that could be setWLSEnv.sh/.cmd. 如果您查看实际调用可能是setWLSEnv.sh/.cmd的环境设置文件的wlst.cmd或.sh文件。 If you run that from where you are having the this python script. 如果你从你拥有这个python脚本的地方运行它。 That script will work, it is simple java CLASSPATH funda nothing else! 那个脚本会起作用,简单的java CLASSPATH基本没什么别的!

Probably you might be running wlst.cmd after navigating to the common bin folder like 可能在导航到公共bin文件夹之后你可能正在运行wlst.cmd

cd /oracle/fmwhome/Oracle_SOA1/common/bin/.

instead you can run in your script like this 相反,你可以像这样在你的脚本中运行

C:\WLS\script\>/oracle/fmwhome/Oracle_SOA1/common/bin/wlst.cmd filename.py

or 要么

C:\WLS\script\>/oracle/fmwhome/Oracle_SOA1/common/bin/setWLSEnv.cmd
C:\WLS\script\>java weblogic.WLST filename.py

You can also refer for more sca related scripting: WLSTByExamples 您还可以参考更多与sca相关的脚本: WLSTByExamples

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM