WebSphere Application Server & Liberty

 View Only
  • 1.  How to change the Generic JVM Arguments using wsadmin command?

    Posted Mon April 26, 2021 01:40 AM

    What are the commands to change the Generic JVM Arguments using wsadmin scripting tool in WebSphere Application Server?



    #Support
    #SupportMigration
    #WebSphereApplicationServer(WAS)


  • 2.  RE: How to change the Generic JVM Arguments using wsadmin command?
    Best Answer

    Posted Mon April 26, 2021 01:44 AM

    You can change the Generic JVM arguments using wsadmin scripting tool.

    [wsadmin scripting tool]

    https://www.ibm.com/docs/was-nd/9.0.5?topic=scripting-wsadmin-tool

    We have only the function to set/replace it.

    (We don't have a function to remove a part of it.)

    Here is the sample:

    --------------

    If you need to change the Generic JVM arguments for server1 under Node01.

    1) Start the wsadmin scripting tool

    ./wsadmin.sh -lang jython -username [username] -password [password]

    2) check the current Generic JVM arguments

    wsadmin>print AdminTask.showJVMProperties('[-nodeName Node01 -serverName server1 -propertyName genericJvmArguments]')

    * please replace the each value to your node name and server name.

    3) set the value for generic JVM arguments

    wsadmin>AdminTask.setGenericJVMArguments('[-nodeName Node01 -serverName server1 -genericJvmArguments "xxxxx"]')

    * please replace xxxxx to your value which you need to use from now on.

    You will receive 'true' after setting it.

    4) save the changes

    wsadmin>AdminConfig.save()

    5) check the Generic JVM arguments if it has changed correctly.

    wsadmin>print AdminTask.showJVMProperties('[-nodeName Node01 -serverName server1 -propertyName genericJvmArguments]')

    6) restart the server1 for the changes to take effect.

    ---------------

    For more detail on parameters (setGenericJVMArguments and showJVMProperties), please refer to the following link:

    [ServerManagement command group for the AdminTask object]

    https://www.ibm.com/docs/was-nd/9.0.5?topic=scripting-servermanagement-command-group-admintask-object



    #Support
    #SupportMigration
    #WebSphereApplicationServer(WAS)


  • 3.  RE: How to change the Generic JVM Arguments using wsadmin command?

    Posted Mon October 02, 2023 03:28 PM

    This solution doesn't really seem to allow replacing / editing specific parts of the generic JVM arguments.

    For example, if these arguments are defined:

    "-Xdump:stack:events=allocation,filter=#32m -Xverbosegclog:verbosegc.%Y%m%d.%H%M%S.%pid.txt,10,10000"

    then I can't just replace the -Xverbosegclog  parameter with another value, e.g. if I want 20000 instead of 10000 cycles. I have to specify the entire string of generic JVM arguments again - which means I need to add some logic to parse and recompose the entire string again - 
    or is there another solution?



    ------------------------------
    Christian Lohmann
    ------------------------------



  • 4.  RE: How to change the Generic JVM Arguments using wsadmin command?

    Posted Tue October 03, 2023 01:51 AM

    There is no way just to update the JVM arguments without either using the console or using a command like sed on Unix/Linux to do a find and replace of it, then you would to synchronize the nodes.

    Brian



    ------------------------------
    Brian S Paskin
    Sr. Technology Engineer
    IBM Cloud Engineering
    ------------------------------



  • 5.  RE: How to change the Generic JVM Arguments using wsadmin command?

    Posted Tue October 03, 2023 09:44 AM

    You must run the following command

    /wsadmin.sh -lang jython -port {{ __dmgr_soap_port }} -username {{ __was_username }} -password {{ __was_password }} -f {{ __rsp_file }}

    and in response file use this code, example:

    #Configure Applicaton Security
    AdminTask.setJVMProperties('[-nodeName {{ __was_nodename }} -serverName dmgr -verboseModeGarbageCollection true -initialHeapSize 2048 -maximumHeapSize 2048  -genericJvmArguments "-Duser.language=en -Duser.region=US"]')
    #Save and Synchronise
    AdminConfig.create('Property', '(cells/{{ __was_cellname }}/nodes/{{ __was_nodename }}/servers/dmgr|server.xml#JavaVirtualMachine_1)', '[[validationExpression ""] [name "java.net.preferIPv4Stack"] [description ""] [value "true"] [required "false"]]') 
    AdminConfig.save()
    # End of File


    In my genericJvmArguments, I put the JVM to use English as default language.

    If you need to change in multiple server, you can see my Ansible scripts: https://github.com/ebasso/ansible-ibm-websphere/



    ------------------------------
    ENIO RUBENS BASSO
    ------------------------------