Search code examples
jvmweblogicjythonwlstbea

Is there a way to use WLST to get JVM arguments of a WebLogic node?


How can one get the JVM startup arguments of a WebLogic node, using WLST? This would be the same information gathered from the Admin console (Environment --> Server Start tab --> Arguments) as shown outlined in red in the screen-shot here.WebLogic Admin console Server Start properties

This data seems to also appear in a properties file at path $WEBLOGIC_DOMAIN_PATH/servers/$NODE_NAME/data/nodemanager but I would like if possible to grab this information from inspecting a live instance of a running WebLogic node.

Here is a WLST snippet that successfully gets the CLASSPATH, but not the JVM start up arguments:

  domainRuntime()
  svrRuntimes = domainRuntimeService.getServerRuntimes()
  for svr in svrRuntimes:
    serverName = svr.getName()

    # Successfully gets CLASSPATH using the following syntax...
    print str(serverName) + " CLASSPATH: " + str(svr.getServerClasspath())

    # Would like to also be able to get JVM startup arguments, like
    # the following commented-out line, which does not work:
    # print str(serverName) + " ARGS: " + str(svr.getArguments())

Many thanks for any suggestions on this. I have been sifting through many websites and the WLST reference trying to find out how to do this.


Solution

  • You can request this information from the mbean "java.lang:type=Runtime" and its attribute "InputArguments" :

    on=ObjectName("java.lang:type=Runtime")
    attrs=mbs.getAttribute(on,"InputArguments")
    for attr in attrs:
      print attr