Monday, April 11, 2011

"OutOfMemoryError: PermGen space" when deploying SOA composites via Ant

Problem:

When deploying SOA Suite 11g composites, you may run out of Java perm space as shown below. This typically happens when trying to deploy many projects in sequence. A simple workaround is to simply restart your Ant deployment and all will be okay... for a while.
deploy:
[input] skipping input as property serverURL has already been set.
[input] skipping input as property sarLocation has already been set.
[deployComposite] setting user/password..., user=weblogic
[deployComposite] Processing sar=/u01/svn/HelloWorld/deploy/sca_HelloWorld_rev1.0.jar
[deployComposite] Adding sar file - /u01/svn/HelloWorld/deploy/sca_HelloWorld_rev1.0.jar
[deployComposite] INFO: Creating HTTP connection to host:soasandbox.ipnweb.com, port:8001
[echo]
[echo] ERROR IN TRYCATCH BLOCK:
[echo] /u01/scripts/build.soa.xml:112: The following error occurred while executing this line:
[echo] /u01/scripts/build.soa.xml:138: The following error occurred while executing this line:
[echo] /u01/app/oracle/middleware/Oracle_SOA1/bin/ant-sca-deploy.xml:188: java.lang.OutOfMemoryError: PermGen space
[echo]

Solution:

For the longest time, we thought that the perm space out of memory was caused by the server, when in fact it was caused by the client (i.e., the machine that was running Ant).

1. Prior to executing Ant, increase the size of the PermSize and MaxPermSize flags. For example:
export ANT_OPTS="-Xmx1536M -Xms1536M -XX:MaxNewSize=800M -XX:NewSize=800M -XX:SurvivorRatio=12 -XX:PermSize=1024M -XX:MaxPermSize=1024M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC"

A colleague of mine, M.P., provided the solution above to me. Thanks!


Applicable Versions:
  • Oracle SOA Suite 11g (11.1.1.x)

Ahmed Aboulnaga