Configuring the Java virtual machine using scripting

Use scripting to configure settings for a Java virtual machine.

Before you begin

Before starting this task, the wsadmin tool must be running. See the Starting the wsadmin scripting client article for more information.

About this task

To modify the Java virtual machine (JVM) of a server to turn on debug, perform the following steps:

Procedure

  1. There are two ways to perform this task. Choose one of the following:
    • Using the AdminTask object:
      • Using Jacl:

        $AdminTask setJVMDebugMode {-serverName server1 -nodeName node1 -debugMode true}
      • Using Jython:
        AdminTask.setJVMDebugMode (['-serverName', 'server1', '-nodeName', 'node1', '-debugMode', 'true'])
    • Using the AdminConfig object:
      1. Identify the server and assign it to the server1 variable.
        • Using Jacl:

          set server1 [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
        • Using Jython:
          server1 = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/')
          print server1
        Example output:
        server1(cells/mycell/nodes/mynode/servers/server1|server.xml#Server_1)
      2. Identify the JVM belonging to this server and assign it to the jvm variable.
        • Using Jacl:

          set jvm [$AdminConfig list JavaVirtualMachine $server1]
        • Using Jython:
          jvm = AdminConfig.list('JavaVirtualMachine', server1)
          print jvm

        Example output:

        [AIX HP-UX Linux Solaris Windows]
        (cells/mycell/nodes/mynode/servers/server1:server.xml#JavaVirtualMachine_1)
        [z/OS]
        (cells/mycell/nodes/mynode/servers/server1:server.xml#JavaVirtualMachine_1)
        (cells/mycell/nodes/mynode/servers/server1:server.xml#JavaVirtualMachine_2)
      3. [z/OS] Identify the controller JVM of the server and its servant region JVM.
        • Using Jacl:

          set cjvm [lindex $jvm 0]
          set sjvm [lindex $jvm 1]
        • Using Jython:
          # get line separator
          import java
          lineSeparator = java.lang.System.getProperty('line.separator')
          arrayJVMs = jvm.split(lineSeparator)
          cjvm = arrayJVMs[0]
          sjvm = arrayJVMs[1]
      4. Modify the JVM to turn on debugging.

        Using Jacl:

        [AIX HP-UX Linux Solaris Windows]
        $AdminConfig modify $jvm {{debugMode true} {debugArgs "-Djava.compiler=NONE -Xdebug -Xnoagent 
        -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777"}}
        [z/OS]
        $AdminConfig modify $cjvm {{debugMode true} {debugArgs "-Djava.compiler=NONE -Xdebug -Xnoagent 
        -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777"}}
        $AdminConfig modify $sjvm {{debugMode true} {debugArgs "-Djava.compiler=NONE -Xdebug -Xnoagent 
        -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777"}}

        Using Jython:

        [AIX HP-UX Linux Solaris Windows]
        AdminConfig.modify(jvm, [['debugMode', 'true'], ['debugArgs',  "-Djava.compiler=NONE -Xdebug 
        -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777"]])
        [z/OS]
        AdminConfig.modify(cjvm, [['debugMode', 'true'], ['debugArgs',  "-Djava.compiler=NONE -Xdebug 
        -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777"]])
        AdminConfig.modify(sjvm, [['debugMode', 'true'], ['debugArgs',  "-Djava.compiler=NONE -Xdebug 
        -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777"]])
  2. Save the configuration changes. See the Saving configuration changes with the wsadmin tool article for more information.
  3. In a network deployment environment only, synchronize the node. See the Synchronizing nodes with the wsadmin tool article for more information.



In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Aug 29, 2010 9:31:45 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=vela&product=was-nd-mp&topic=txml_jvm
File name: txml_jvm.html