首页 > 解决方案 > 在 WLST 中导入 python 模块(weblogic 脚本工具)

问题描述

我需要在 WLST 中导入 python 模块。例如,我需要 WLST 中的“信号”模块来编写超时函数。所以我问你怎么做。

环境:Oracle Linux 6、Oracle Weblogic 11

此外,我让您查看 WLST 中的一段代码,其中我需要一个超时函数,以及它引发异常的原因:

import sys
import os
from java.lang import System
import getopt
import time as systime

[...]

def _startServer(ServerName):
    while(true)
        try:
            cd('domainRuntime:/ServerLifeCycleRuntimes/'+ServerName);

            cmo.start();
            state=_serverstatus(ServerName);
            while (state!='RUNNING'):
                state=_serverstatus(ServerName);
                java.lang.Thread.sleep(5000);

            #=================
            # timeout function
            #=================

        except:
            print 'Error in getting current status of ' +ServerName+ '\n';
            print 'Please check logged in user has full access to complete the start operation on ' +ServerName+ '\n';

            os.popen('sh /home/oracle/scripts/logAnalytics.sh')
            systime.sleep(60)

            exit()
        break

[...]

标签: pythonweblogicpython-modulewlst

解决方案


推荐阅读