如何使用 WLST 创建新的 Unix 机器

How to create a new Unix Machine with WLST

我正在尝试为 WebLogic Managed Server 创建一个 Docker 图像。我的图像快完成了,图像中只缺少工作管理器。

据我所知,为了拥有一个工作管理器,我需要创建一个 Machine。我正在使用 WLST 工具创建服务器、集群等,除了创建新的机器部件外,一切看起来都很好。

我的 Phyton 方法是这样的:

1 def createMachine(_machineName):
2  print ('creating a new machine...')
3  cd('/')
4  cmo.createUnixMachine(_machineName)
5  cd('/Machines/' + _machineName + '/NodeManager/' + _machineName)
6  cmo.setNMType('Plain')
7  cmo.setListenAddress('localhost')
8  cmo.setListenPort(8888)
9  cmo.setDebugEnabled(false)

第 4 行为我抛出一个错误:

creating a new machine...
Error: only getter and setter are supported
Error: cd() failed. Do dumpStack() to see details.
Error: runCmd() failed. Do dumpStack() to see details.
Problem invoking WLST - Traceback (innermost last):
  File "/u01/oracle/create-wls-domain.py", line 114, in ?
  File "/u01/oracle/create-wls-domain.py", line 104, in main
  File "/u01/oracle/create-wls-domain.py", line 36, in createMachine
  File "/tmp/WLSTOfflineIni692244145222764912.py", line 55, in cd
  File "/tmp/WLSTOfflineIni692244145222764912.py", line 19, in command
    at com.oracle.cie.domain.script.jython.CommandExceptionHandler.handleException(CommandExceptionHandler.java:69)
    at com.oracle.cie.domain.script.jython.WLScriptContext.handleException(WLScriptContext.java:2983)
    at com.oracle.cie.domain.script.jython.WLScriptContext.runCmd(WLScriptContext.java:735)
    at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)

com.oracle.cie.domain.script.jython.WLSTException: com.oracle.cie.domain.script.jython.WLSTException: No element AnyMachine was found

执行*.py脚本时WL服务器不在运行,所以我处于离线模式,因为域还没有准备好,它正在由*.py脚本创建.

我的机器创建方法有什么问题?

更新

所以这是创建 WebLogic Machine 的工作方法:

def createMachine(_machineName):
    print('creating a new machine...')
    cd('/')
    create(_machineName,'UnixMachine')

    # if you need NodeManager as well 
    # cd('/UnixMachine/' + _machineName)
    # create(_machineName, 'NodeManager')
    # cd('NodeManager/' + _machineName)
    # setNMType('Plain')
    # set('ListenAddress', 'localhost')
    # set('ListenPort', _nodeManagerPort)
    # setDebugEnabled(false)

第 4 行应该是

create(_machineName,'UnixMachine')