Reputation: 5410
Here is an exception we get when trying to compile a freshly checked out code under Windows Server 2003 with Maven 2.2.1 and JDK 1.6.0_23. Several machines running Ubuntu with the same Maven and JDK version have no problems at all compiling the exact same source.
Have tried providing alternative Maven options (i.e. MAVEN_OPTS=-Xms256m -Xmx1024m) to no avail.
What could be the cause of this problem and what would be a possible solution? Thanx.
[INFO] Compilation failure
Failure executing javac, but could not parse the error:
The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1799)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1522)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:377)
at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1241)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1210)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
... then trace repeats multiple times
Upvotes: 16
Views: 29071
Reputation: 211
I have also come across the same problem. To fix it what I did, is- I ran the below command in console
set MAVEN_OPTS=-Xms256m -Xmx1024m -Xss1024k *-XX:MaxPermSize=384m
instead of-
set MAVEN_OPTS=-Xms256m -Xmx1024m -Xss1024k *-XX:MaxPermSize=128m
Try this, It would definitely work. If still you get same problem then replace
-XX:MaxPermSize=384m
to
-XX:MaxPermSize=512m
Upvotes: 0
Reputation: 1
The comment below is a working answer
set MAVEN_OPTS=-Xms256m -Xmx1024m -Xss1024k -XX:MaxPermSize=384m"
Upvotes: 0
Reputation: 719386
What could be the cause of this problem and what would be a possible solution? Thanx.
Here are some possible causes:
Upvotes: 2
Reputation: 274788
Is any of your code being auto-generated e.g. from a WSDL? Can you pinpoint which class(es) is causing the problem? One way of doing this would be to remove some of your source, recompile and repeat until you have narrowed down to a small subset of classes.
Do you have any large classes or long methods? If so, you should refactor.
Increase the stack size. I think the default is 512k. Change the compiler configuration to:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<compilerArgument>-J -Xss10M</compilerArgument>
</configuration>
</plugin>
Upvotes: 9
Reputation: 240948
try
MAVEN_OPTS=-Xms256m -Xmx1024m -Xss1024k
Note: -Xss , should be set according to hardware available
Upvotes: 17