views:

206

answers:

2

We are using Eclipselink and need to weave the code in order for lazy fetching to work property.

During the weave process I'm getting the following error:

weave:  

BUILD FAILED  
java.lang.OutOfMemoryError: PermGen space  

I have the following tasks within my ant build file:

<target name="define_weave_task" description="task definition for EclipseLink static weaving">  
   <taskdef name="eclipse_weave" classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask"/>  
</target>  

<target name="weave" depends="compile,define_weave_task" description="weave eclipselink code into compiled classes">  
   <eclipse_weave source="${path.classes}" target="${path.classes}">  
       <classpath refid="compile.classpath"/>  
   </eclipse_weave>  
</target>  

It has been working great for a long time. Now that the amount of code to be woven has increased I'm getting the PermGen error. I would like to be able to up the amount of perm space.

If I was doing a compile I would be able to up the perm space via a compiler argument such as <compilerarg value="-XX:MaxPermSize=256M"/> but this does not appear to be a valid argument for eclipselink weaving.

How can I up the perm space for the weave?

+1  A: 

If you're running the Ant task "in the same JRE as Eclipse" then it's Eclipse itself that you must start up with an obese permgen.

Jonathan Feinberg
I'm running ant from the linux shell, but you did give me a good hint, I could look at changing the defaults of the jre.
rayd09
A: 

The answer is to set the max perm memory parameter in the ANT_OPTS environment variable before running ant.

export ANT_OPTS="-XX:MaxPermSize=256m"

rayd09