Friday, August 31, 2012

Which JVM?

When you report java.lang.OutOfMemoryError: Java heap space, you need to tell people which JVM has thrown the exception.  Sometimes this can be obvious and sometimes it isn't (see below).

An OutOfMemoryError does not necessarily imply a memory leak. The issue might simply be a configuration issue, for example if the specified heap size (or the default size if not specified) is insufficient for the application[1].  In that case, you need to figure out which configuration file to modify.

jps Command

You can use jps (Java Virtual Machine Process Status Tool) to list all local VM identifiers of instrumented HotSpot Java Virtual Machines (JVMs) on the target Linux system.  For example, on my system, it lists:

$ jps 
17291 Server
17468 Jps
7883 Launcher

This list includes one Integrated WebLogic Server (i.e., Server) and one JDeveloper (i.e., Launcher). Note that JDeveloper and Integrated WLS use their own JVM's. So, if you're running Integrated WLS from JDeveloper, you need to know which JVM has thrown the OutOfMemoryError exception.

Configuration Files

Each application uses its own configuration file to start its JVM and you need to know where to find it.

For example, to change heap space sizes, you can modify those parameters in:
  • JDeveloper
    • $JDEV_HOME/jdev/bin/jdev.conf
    • or 'which jdev' and find its containing directory; jdev.conf should be located in the same directory 
    • Note that jdev.conf includes ide.conf which contains the following configurations:
      • AddVMOption  -Xmx640M
      • AddVMOption  -Xms128M
  • WebLogic Server
    • You have two options:
      • Modify MEM_ARGS in the
      • $setenv USER_MEM_ARGS "-Xms512m -Xmx1024m -XX:MaxPermSize=1024m -XX:CompileThreshold=8000"
        • This will override the settings from WLS scripts as shown below:
          • if [ "${USER_MEM_ARGS}" != "" ] ; then
            export MEM_ARGS
    • If this is Integrated WLS, your script folder is located under:
      • ../system11.
      • On JDev 12c, the heap size is set by the following line (which is embedded in[5]
        • set SERVER_MEM_ARGS_64=-Xms1024m -Xmx3072m
          • You can trace the settings starting from, to, to, and finally to
  • Eclipse
    • /eclipse.ini

Project Properties

Here is another case which requires the change of project properties in JDeveloper:
  • Scenario:
    • JDeveloper is used to deploy "server-setup-seed-deploy-test" target with "Run Ant Target" and it threw "java.lang.OutOfMemoryError: PermGen space" exception.[2]
  • Solution:
    • In Jdev window, right click the project file >  Project Properties > Ant > Process > Java Options:
      • -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m
    • Note that a new JVM is launched for the Ant process and it uses the above settings.



anne said...

I am deploying Fusion Order Demo using Jdev, it had Out of Merroy error by default. after i add permSize through your suggestion like this, it works fine.
In Jdev window, right click the project file > Project Properties > Ant > Process > Java Options:
-Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m

my problem is i would like to use command "$ANT_HOME/bin/ant server-setup-seed-deploy-test" to deploy in a shell script, then where should i change the parameter for permSize. thanks

XML and More said...

Sorry, I didn't read this until now. Did you try adding -verbose or -debug to your command line? Maybe it can show you how JVM was setup in your environment. If you have resolved this issue, could you share us with your solution? Thanks!

Blogger said...

If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (even if they're dating somebody else now) you have to watch this video
right away...

(VIDEO) Win your ex back with TEXT messages?

Blogger said...

BlueHost is ultimately the best hosting company for any hosting plans you need.