Fix For Maven Fails with java.lang.OutOfMemoryError: Java heap space

2 messages Options
Embed this post
Permalink
rivercode

Fix For Maven Fails with java.lang.OutOfMemoryError: Java heap space

Reply Threaded More More options
Print post
Permalink
Hi,

Maven can sometimes fail with error like following: (see end for solution)


[INFO] [surefire:test]
[INFO] Tests are skipped.
[INFO] [bundle:bundle]
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Java heap space
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Arrays.java:2786)
        at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
        at aQute.lib.osgi.EmbeddedResource.copy(EmbeddedResource.java:64)
        at aQute.lib.osgi.EmbeddedResource.collect(EmbeddedResource.java:53)
        at aQute.lib.osgi.EmbeddedResource.build(EmbeddedResource.java:35)
        at aQute.lib.osgi.EmbeddedResource.build(EmbeddedResource.java:73)
        at aQute.lib.osgi.Verifier.getBundleClassPath(Verifier.java:127)
        at aQute.lib.osgi.Verifier.<init>(Verifier.java:81)
        at aQute.lib.osgi.Builder.doVerify(Builder.java:214)

The solution is to set an environment variable to increase memory:

For example, in windows:

set MAVEN_OPTS=-Xmx512m

This should fix it.
toli

Re: Maven Fails with java.lang.OutOfMemoryError: Java heap space

Reply Threaded More More options
Print post
Permalink
That's correct. In general, it's best to have the MAVEN_OPTS var be set to
export MAVEN_OPTS="-Xmx512m -Xms128m -XX:MaxPermSize=512m
-Dcom.sun.management.jmxremote"

We have it in the Building Marketcetera instructions
(http://www.marketcetera.org/confluence/display/MDN/Building%20Marketcetera%20Platform#BuildingMarketceteraPlatform-Runningmodulesfromcode
) but we'll make that clearer when we post instructions for 0.9.0 -
sorry about that.

thanks for pointing this out

On Fri, Nov 28, 2008 at 7:04 PM, rivercode <[hidden email]> wrote:

>
> Hi,
>
> Maven can sometimes fail with error like following: (see end for solution)
>
>
> [INFO] [surefire:test]
> [INFO] Tests are skipped.
> [INFO] [bundle:bundle]
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Java heap space
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Trace
> java.lang.OutOfMemoryError: Java heap space
>        at java.util.Arrays.copyOf(Arrays.java:2786)
>        at
> java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
>        at aQute.lib.osgi.EmbeddedResource.copy(EmbeddedResource.java:64)
>        at aQute.lib.osgi.EmbeddedResource.collect(EmbeddedResource.java:53)
>        at aQute.lib.osgi.EmbeddedResource.build(EmbeddedResource.java:35)
>        at aQute.lib.osgi.EmbeddedResource.build(EmbeddedResource.java:73)
>        at aQute.lib.osgi.Verifier.getBundleClassPath(Verifier.java:127)
>        at aQute.lib.osgi.Verifier.<init>(Verifier.java:81)
>        at aQute.lib.osgi.Builder.doVerify(Builder.java:214)
>
> The solution is to set an environment variable to increase memory:
>
> For example, in windows:
>
> set MAVEN_OPTS=-Xmx512m
>
> This should fix it.
> --
> View this message in context: http://n2.nabble.com/Maven-Fails-with-java.lang.OutOfMemoryError%3A-Java-heap-space-tp1591279p1591279.html
> Sent from the m-etc-dev mailing list archive at Nabble.com.
>
>
> _______________________________________________
> m-etc-dev mailing list
> [hidden email]
> http://lists.marketcetera.org/mailman/listinfo/m-etc-dev_lists.marketcetera.org
>



--
Toli Kuznets
http://www.marketcetera.com: Open-Source Trading Platform
download.run.trade.

_______________________________________________
m-etc-dev mailing list
[hidden email]
http://lists.marketcetera.org/mailman/listinfo/m-etc-dev_lists.marketcetera.org