Search code examples
dockerweblogicweblogic12cwlst

How to create a new Unix Machine with WLST


I am trying to create a Docker image for WebLogic Managed Server. My image is almost done, only the work manager is missing from the image.

As I know, in order to have a work manager, I need to create a Machine. I am using the WLST tool to create a server, cluster, etc. and everything looks fine except creating a new machine part.

This is how my Phyton method looks like:

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)

Line 4 throws an error for me:

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

The WL server is not running at the time when the *.py script is executed, so I am in offline mode because the domain is not ready, it is under creation by the *.py script.

What is wrong with my machine creation method?

UPDATE

So this is the working method to create a 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)

Solution

  • line 4 should be

    create(_machineName,'UnixMachine')