How to append JVM options to JWS for OpenShift

Solution Verified - Updated

Environment

  • Red Hat JBoss Web Server for OpenShift
    • 5
    • 6

Issue

  • How to append JVM options to JWS for OpenShift
  • The setting environment variable JAVA_OPTS_APPEND does not work on JWS for OpenShift.

Resolution

It's possible to add the environment variable CATALINA_OPTS_APPEND to a pod or DeploymentConfig like below:

oc set env dc/<DeploymentConfig-name> CATALINA_OPTS_APPEND="-XX:+HeapDumpOnOufOfMemoryError -XX:HeapDumpPath=/<path-to-dump-destination-dir/>"

Setting JAVA_OPTS_APPEND doesn't work has been filed as a known issue Content from issues.jboss.org is not included.CLOUD-2899[JWS] JAVA_OPTS_APPEND not working.
GC_CONTAINER_OPTIONS should be used to change GC algorithm from the default parallel collector to something else per This content is not included.CLOUD-2941

oc set env dc/<DeploymentConfig-name> GC_CONTAINER_OPTIONS="-XX:+UseG1GC"

Root Cause

The JWS container does not have the JAVA_OPTS and JAVA_OPTS_APPEND flags, so the following need to be used:

JWS environment variableEquivalent in OpenJDK image
CATALINA_OPTSEquivalent of JAVA_OPTS
CATALINA_OPTS_APPENDEquivalent of JAVA_OPTS_APPEND
GC_CONTAINER_OPTIONSSame as OpenJDK's GC_CONTAINER_OPTIONS
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.