IBM i Batch Jobs – Out Of Memory Java Error


Mar 01


The Java Heap size is not set high enough.

Resolving the problem

These steps help increase the JVM max heap size from the default of 1 GB.

Heap size specifies the amount of dynamic memory to be made available to the JVM code. For systems with less than 1 GB of physical memory, use a maximum heap size of 256 MB, and an initial heap size of 0 MB.

For systems with 2 GB memory, use a maximum heap size of 768 MB, and an initial heap size of 256 MB.

For larger systems (more than 2GB), use a maximum heap size of 1024 MB, and an initial heap size of 512 MB.

To set the maximum and initial heap size:

  1. In the IBM┬« WebSphere┬« Application Server administrative console, click Servers Application Servers.
  2. Select the application server you want to configure.
  3. In the Server Infrastructure area, select Java and Process Management.
  4. Click Process definition.
  5. In the Additional Properties area, select Java Virtual Machine.
  6. In the General Properties box, provide the following heap values:
    • Initial Heap Size
    • Maximum Heap Size
  7. Save your changes.
  8. Stop and restart WebSphere Application Server for your changes to take effect.

Can’t find the Setting?

Look under the “Web Performance Advisor” Tab:

IBM i Batch Jobs - Out Of Memory Java Error 1
IBM i Batch Jobs - Out Of Memory Java Error 2

No Web Access – How do we do this with Green Screen?

When it is not possible to change WebSphere Application Server (WAS) JVM heap size via WAS Admin console, the server.xml can be edited in order to increase the JVM maximum heap size. Follow the steps below:

  1. First make a backup copy of the current server.xml file. Navigate to the profile-root/config/cells/nodes/servers folder.
    By default: /install_root/profiles/<profile_name>/config/cells/<cellname>/nodes/<nodename>/servers/server1/server.xml 
    For example: /opt/IBM/WebSphere/AppServer/profiles/InfoSphere/config/cells/ibm123Node01Cell/nodes/ibm123Node01/servers/server1

  2. Search for the <processDefinitions> and <jvmEntries> tag at the end of the file. Then, update these parameters: “initialHeapSize=”1280″ maximumHeapSize=”2048” 

    For example, the server.xml should look something like this: 
    <jvmEntries xmi:id=”JavaVirtualMachine_1183122130078″ verboseModeClass=”false” verboseModeGarbageCollection=”true” verboseModeJNI=”false” initialHeapSize=”1280″ maximumHeapSize=”2048″ runHProf=”false” hprofArguments=”” debugMode=”false” debugArgs=”-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777″ genericJvmArguments=”-Xdisableexplicitgc -Djava.awt.headless=true -Xjit:{com/ibm/db2/jcc/*}(disableIdiomRecognition)”>

  3. Save the server.xml file and restart WebSphere.

About the Author

IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.

%d bloggers like this: