Maven misery

133 views
Skip to first unread message

Maxime Lévesque

unread,
Aug 12, 2010, 7:52:17 PM8/12/10
to Lift

I have a hard time building Lift with maven ...thank god (or
Indrajit ;-)) SBT is on it's way....

If I build (mvn install) with the params :

set MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=256M

I get :

[INFO] Compiling 5 source files to D:\dev\lift\framework\lift-base
\lift-common\target\classes at 1281656830680
[ERROR] Error occurred during initialization of VM
[INFO] Could not create the Java virtual machine.
[INFO] Could not create the Java virtual machine.Could not reserve
enough space for object heap
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR


If I set set MAVEN_OPTS=-Xmx1624m -XX:MaxPermSize=128m

it crashes even more quickly :

D:\dev\lift>set MAVEN_OPTS=-Xmx1624m -XX:MaxPermSize=128m
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

Any clues ?

Maxime Lévesque

unread,
Aug 12, 2010, 8:09:00 PM8/12/10
to Lift

FWIW, I have maven 2.2.1 ... This used to work with previous
builds...

Ross Mellgren

unread,
Aug 12, 2010, 8:08:45 PM8/12/10
to lif...@googlegroups.com
This error indicates that you're giving it too much heap for your system. You might need to quit some things? How much physical RAM do you have?

-Ross

> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>

Maxime Lévesque

unread,
Aug 12, 2010, 8:39:39 PM8/12/10
to Lift

I have 4G of physical ram (64bit)

I tried quitting a bunch of things until I'm at 1,38G usage, it still
won't start at
MAVEN_OPTS=-Xmx1600m or above, if I set it below, it runs for a while
and then crashes.

Thanks

Ross Mellgren

unread,
Aug 12, 2010, 9:13:44 PM8/12/10
to lif...@googlegroups.com
What's the precise crash if you set it lower?

-Ross

Maxime Lévesque

unread,
Aug 12, 2010, 9:30:21 PM8/12/10
to Lift

at MAVEN_OPTS=-Xmx1024m I get :

>mvn -e install

[ERROR] Error occurred during initialization of VM
[INFO] Could not reserve enough space for object heap
[INFO] Could not create the Java virtual machine.
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] wrap: org.apache.commons.exec.ExecuteException: Process exited
with an error: 1(Exit value: 1)

[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: wrap:
org.apache.commons.exec.ExecuteException: Process exited with an
error: 1(Exit value: 1)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:
719)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:
556)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:
535)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:
387)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:
348)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:
180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:
328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:
138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:
60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: wrap:
org.apache.commons.exec.ExecuteException: Process exited with an
error: 1(Exit value: 1)
at
org_scala_tools_maven.ScalaMojoSupport.execute(ScalaMojoSupport.java:
348)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:
490)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:
694)
... 17 more
Caused by: org.apache.commons.exec.ExecuteException: Process exited
with an error: 1(Exit value: 1)
at
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:
346)
at
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:
149)
at
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:
136)
at
org_scala_tools_maven_executions.JavaMainCallerByFork.run(JavaMainCallerByFork.java:
80)
at
org_scala_tools_maven.ScalaCompilerSupport.compile(ScalaCompilerSupport.java:
184)
at
org_scala_tools_maven.ScalaCompilerSupport.doExecute(ScalaCompilerSupport.java:
115)
at
org_scala_tools_maven.ScalaMojoSupport.execute(ScalaMojoSupport.java:
340)
... 19 more

David Pollak

unread,
Aug 12, 2010, 10:45:45 PM8/12/10
to lif...@googlegroups.com
What OS are you running?

2010/8/12 Maxime Lévesque <maxime....@gmail.com>



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics

Ross Mellgren

unread,
Aug 12, 2010, 10:49:49 PM8/12/10
to lif...@googlegroups.com
He's running Windows.

-Ross

David Pollak

unread,
Aug 12, 2010, 10:52:30 PM8/12/10
to lif...@googlegroups.com


On Thu, Aug 12, 2010 at 7:49 PM, Ross Mellgren <dri...@gmail.com> wrote:
He's running Windows.

If he's running windows with a 32 bit JVM, there's a well known issue with not being able to allocate more than 1.5GB of heap or maybe it's 1.5GB of total RAM.

Maybe Marius can lend some insight as to how he does builds (he's running Windows as well.)

Naftoli Gugenheim

unread,
Aug 12, 2010, 11:06:38 PM8/12/10
to liftweb
Could it be he's seeing the DLL memory fragmentation problem?
I recall reading once that Windows sometimes loads some DLLs in the middle of memory, and the JVM needs its RAM to be contiguous. Unfortunately I don't remember the solution (I think it was a bit complex--it could have to do with how the DLL was compiled), but I assume that starting in safe mode (or diagnostic startup via msconfig) would tell you whether that was indeed the problem.

David Bernard

unread,
Aug 13, 2010, 2:27:44 AM8/13/10
to lif...@googlegroups.com
Maxime,

maven-scala-plugin doesn't run scalac in the same process as maven. To define jvm args used to run scalac (including mx, permsize,...)
you should customize maven-scala-plugin configuration (MAVEN_OPTS is not used)

        <configuration>
          <jvmArgs>
            <jvmArg>-Xms64m</jvmArg>
            <jvmArg>-Xmx1024m</jvmArg>
            <jvmArg>-XX:MaxPermSize=128m</jvmArg>
          </jvmArgs>
        </configuration>


/davidB

2010/8/13 Maxime Lévesque <maxime....@gmail.com>

Maxime Lévesque

unread,
Aug 13, 2010, 7:51:17 AM8/13/10
to Lift

Thanks guys, changing the -Xms in the POM did it,

the ./framework/pom.xml had this setting :

<jvmArg>-Xmx2g</jvmArg>

I changed it to :

<jvmArg>-Xms64m</jvmArg>
<jvmArg>-Xmx1024m</jvmArg>

and it worked.

Thank you all for your help

On 13 août, 02:27, David Bernard <david.bernard...@gmail.com> wrote:
> Maxime,
>
> maven-scala-plugin doesn't run scalac in the same process as maven. To
> define jvm args used to run scalac (including mx, permsize,...)
> you should customize maven-scala-plugin configuration (MAVEN_OPTS is not
> used)
>
>         <configuration>
>           <jvmArgs>
>             <jvmArg>-Xms64m</jvmArg>
>             <jvmArg>-Xmx1024m</jvmArg>
>
>             <jvmArg>-XX:MaxPermSize=128m</jvmArg>
>           </jvmArgs>
>         </configuration>
>
> seehttp://scala-tools.org/mvnsites/maven-scala-plugin/example_compile.ht...
>
> <http://scala-tools.org/mvnsites/maven-scala-plugin/example_compile.ht...>/davidB
>
> 2010/8/13 Maxime Lévesque <maxime.leves...@gmail.com>
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com>
> > .

Indrajit Raychaudhuri

unread,
Aug 13, 2010, 1:03:36 PM8/13/10
to lif...@googlegroups.com
However, for full build (with docs and other stuff) max heap of 1024m
doesn't always suffice. Thus I had bumped this up to 2048m.

As a way out, does it make sense to retain the default max heap of 2048m
and create a windows specific profile with 1024m?

- Indrajit

Maxime L�vesque wrote:
> Thanks guys, changing the -Xms in the POM did it,
>
> the ./framework/pom.xml had this setting :
>
> <jvmArg>-Xmx2g</jvmArg>
>
> I changed it to :
>
> <jvmArg>-Xms64m</jvmArg>
> <jvmArg>-Xmx1024m</jvmArg>
>
> and it worked.
>
> Thank you all for your help
>

> On 13 ao�t, 02:27, David Bernard<david.bernard...@gmail.com> wrote:
>> Maxime,
>>
>> maven-scala-plugin doesn't run scalac in the same process as maven. To
>> define jvm args used to run scalac (including mx, permsize,...)
>> you should customize maven-scala-plugin configuration (MAVEN_OPTS is not
>> used)
>>
>> <configuration>
>> <jvmArgs>
>> <jvmArg>-Xms64m</jvmArg>
>> <jvmArg>-Xmx1024m</jvmArg>
>>
>> <jvmArg>-XX:MaxPermSize=128m</jvmArg>
>> </jvmArgs>
>> </configuration>
>>
>> seehttp://scala-tools.org/mvnsites/maven-scala-plugin/example_compile.ht...
>>
>> <http://scala-tools.org/mvnsites/maven-scala-plugin/example_compile.ht...>/davidB
>>

>> 2010/8/13 Maxime L�vesque<maxime.leves...@gmail.com>

Derek Chen-Becker

unread,
Aug 13, 2010, 3:09:39 PM8/13/10
to lif...@googlegroups.com
My experience being forced to use Windows servers at work actually had it failing to allocate even 1GB of memory on a machine with 4GB total and only 900MB allocated to all other processes :( In fact, on the same machine it would sometimes allocate up to 1.2GB, but it was never consistent. Management decided to shovel money on the problem and ponied up for 64 bit Windows...
Reply all
Reply to author
Forward
0 new messages