#AskMe

Error: Could not create the Java Virtual Machine [Vaadin]

Vaadin built and received an error as error log:

[INFO] Using com.vaadin:vaadin-client-compiler version 7.2.7
[INFO] Error occurred during initialization of VM
[INFO] Could not reserve enough space for object heap
[ERROR] Error: Could not create the Java Virtual Machine.
[ERROR] Error: A fatal exception has occurred. Program will exit.

[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:7.2.7:update-widgetset
..
]] failed with status 1
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
..
]] failed with status 1
        at org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo$JavaCommand.execute(AbstractGwtShellMojo.java:485)

 

You might first like me, could not identify the first message of the error and trying to find out the error lines instead of the messages before the [ERROR] statement. The issue links to maven configuration to compile the Vaadin/GWT project.

Cause & Solution

The issue because I set memory of -Xmx1024M -Xss1024k -XX:MaxPermSize=512M as in my pom.xml in block of plugin: vaadin-maven-plugin

<configuration>
	<gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath>
	<extraJvmArgs>-Xmx1024M -Xss1024k -XX:MaxPermSize=512M</extraJvmArgs>
	<webappDirectory>${basedir}/target/tmp/resources/VAADIN/widgetsets</webappDirectory>
	[..]
</configuration>

This setting is wrong for my PC with RAM only 3GB. So I just need to lower it to:

<configuration>
	<gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath>
	<extraJvmArgs>-Xmx512M -Xss512k -XX:MaxPermSize=256M</extraJvmArgs>
	<webappDirectory>${basedir}/target/tmp/resources/VAADIN/widgetsets</webappDirectory>
	<hostedWebapp>${basedir}/target/tmp/resources/VAADIN/widgetsets</hostedWebapp>
	<noServer>true</noServer>
	<persistentunitcachedir>${basedir}/target/tmp/gwt-unitCache</persistentunitcachedir>
	<compileReport>true</compileReport>
	<strict>true</strict>
	<runTarget>http://localhost:8080/</runTarget>
</configuration>