+

Search Tips   |   Advanced Search

Set the Java virtual machine using scripting


Use wsadmin to configure settings for a Java ™ virtual machine (JVM). As part of configuring an appserver, we might define settings that enhance the way the operating system uses of the Java virtual machine.

There are three ways to perform this task. Use the steps in this topic to use the setJVMDebugMode command for the AdminTask object or the AdminConfig object to modify the JVM configuration. Alternatively, we can use the configureJava VirtualMachine Jython script in the AdminServerManagement script library to enable, disable, or configure the debug mode for the JVM. The wsadmin tool automatically loads the script when the tool starts. Use the following syntax to configure JVM settings using configureJava VirtualMachine script:

AdminServerManagement.configureJava VirtualMachine(nodeName, serverName, debugMode, debugArgs, otherAttributeList)
For additional information and argument definitions, see the documentation for the AdminServerMananagment script library.

The JVM is an interpretive computing engine responsible for running the byte codes in a compiled Java program. The JVM translates the Java byte codes into the native instructions of the host machine. The appserver, being a Java process, requires a JVM in order to run, and to support the Java applications running on it. JVM settings are part of an appserver configuration.

 

  1. Launch the wsadmin scripting tool using Jython.

  2. There are two ways to complete this step. Use the setJVMDebugMode command for the AdminTask object or the AdminConfig object to modify the JVM configuration. Choose one of the following configuration methods:

    • Use the AdminTask object:

      • Jacl...

        $AdminTask setJVMDebugMode {-serverName server1 -nodeName node1 -debugMode true}
      • Jython...

        AdminTask.setJVMDebugMode (['-serverName', 'server1', '-nodeName', 'node1', '-debugMode', 'true'])

    • Use the AdminConfig object:

      1. Identify the server and assign it to the server1 variable, as the following example demonstrates:

        • Jacl...

          set server1 [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
        • Jython...

          server1 = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/')
          print server1

        For example...

        server1(cells/mycell/nodes/mynode/servers/server1|server.xml#Server_1)

      2. Identify the JVM that belongs to the server of interest and assign it to the jvm variable...

        • Jacl...

          set jvm [$AdminConfig list Java VirtualMachine $server1]
        • Jython...

          jvm = AdminConfig.list('Java VirtualMachine', server1) print jvm

        For example...

        (cells/mycell/nodes/mynode/servers/server1:server.xml#Java VirtualMachine_1)

      3. Modify the JVM to enable debugging...

        • Jacl...

          $AdminConfig modify $jvm {{debugMode true} {debugArgs "-Djava.compiler=NONE -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777"}}
        • Jython...

          AdminConfig.modify(jvm, [['debugMode', 'true'], ['debugArgs', "-Djava.compiler=NONE -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777"]])

  3. Save the configuration changes...

    AdminConfig.save()

  4. In a network deployment environment only, synchronize the node. Use the syncActiveNode or syncNode scripts in the AdminNodeManagement script library to propagate the configuration changes to node or nodes.

    • Use the syncActiveNodes script to propagate the changes to each node in the cell...

      AdminNodeManagement.syncActiveNodes()

    • Use the syncNode script to propagate the changes to a specific node, as the following example demonstrates:

      AdminNodeManagement.syncNode("myNode")

 

Related tasks


Set the JVM
Automating server administration using the scripting library

 

Related


Node administration scripts
Server settings configuration scripts
Commands for the AdminConfig object