Java – How to increase heap size for ws_ant.sh when deploying on WebSphere 8.5 (64-bit Linux)

antautomationjavaJenkinswebsphere

TL;DR — How do I give ws_ant.sh and/or the <wsInstallApp> task more heap at runtime?

I am attempting to deploy a relatively large (~160-MB) EAR file to WebSphere 8.5 running on a 64-bit Linux platform.

Here is the task I have in my build.xml:

<wsInstallApp
    ear="/my/ear/file/location/New.EAR"
    properties="jvm.properties"
    options="-appname myNewEarApp -update -deployws"
    host="localhost"
    conntype="SOAP"
    user="the_username"
    password="not_telling_you"
    failonerror="true" />

Executing it with the ws_ant.sh packaged with WAS results in an OutOfMemoryError and heap dumps.

So, I need to increase the heap available to the task (or ws_ant itself?) at runtime, but I cannot figure out the proper place to do so. I tried modifying wsadmin.sh, and while that has an effect if I run my deployment as a Jython script with wsadmin.sh directly, it does not seem to have any impact whatsoever on the execution of <wsInstallApp> from within the Ant script.

According to the IBM documentation of wsInstallApp:

The properties attribute is optional and it contains a java properties file containing attributes to set in the JVM System properties

In my jvm.properties file, I tried:

[user@localhost]$ cat jvm.properties
-Xms4096m
-Xmx4096m

That had no effect. Executing ws_ant.sh with the -v verbose flag showed that, somewhere, the -Xmx value is set as -Xmx256m. I tried several other hair-brained combinations and formats, but nothing seems to work.

I also tried adding arguments onto the ws_ant.sh call:

[user@localhost]$ ws_ant.sh -Xms4096m -Xmx4096m -v -f build.xml was.deploy

… but that also seems to do nothing.

What am I doing wrong? I concede that, if pressed, I could probably meet my requirements by re-writing the deployment using wsadmin.sh and a Jython script, but I'm trying to leverage some extensive Ant scripting from a different EAR application.

Alternatives? I also recognize that I could use the <wsadmin> Ant task to call some Jython scripts from within Ant– I have not yet tried this– but again, we already have some extensive scripting otherwise. What are the relative advantages and disadvantages of one way versus the other? (i.e., executing wsadmin.sh/Jython script via <[ssh]exec> or <wsadmin> versus <wsInstallApp> [and its "ws_____" siblings]).

Best Answer

Try attribute jvmMaxMemory

<wsInstallApp
    ear="/my/ear/file/location/New.EAR"
    jvmMaxMemory="1024M"
    options="-appname myNewEarApp -update -deployws"
    host="localhost"
    conntype="SOAP"
    user="the_username"
    password="not_telling_you"
    failonerror="true" />