简体   繁体   中英

Play Framework Run Application Issue

I am getting the following error whenever i am trying to run a new Web Application created using Play .

Error occurred during initialization of VM
Could not reserve enough space for object heap

Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

In Play framework 2.0.3, <play framework install dir>\\framework\\build.bat script you need to replace the command line argument for the command below

java -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*

Into

java -XX:+CMSClassUnloadingEnabled %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*

Just downloaded and unzipped 2.2.1 on my Windows 8 computer.

Followed the documentation at Play Framework website, and ended up having the same issue as you. Adjusting the various parameters in the build file didn't do anything, but the:

java -XX:+CMSClassUnloadingEnabled %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*

... solved the problem. I don't know where other people found this solution, but there's no mentioning of this solution on the Play Framework website. In fact, there's nothing to suggest that anything could go wrong. After all, it's just a file you need to unzip.

It's running now, however it's a little hard to trust a framework that screws up that early on. Seems the authors don't test on anything but Linux.

in 2.3 Play framework :

    GO to : 

C://Play2.3/framework/build.bat and open this file and make these changes. Replace this line with below line.

java -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\\sbt-launch.jar" %*

java -XX:+CMSClassUnloadingEnabled %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\\sbt-launch.jar" %*

then type this command on command promt:

       C:\Users\k.ashish\Downloads\play-2.2.3\play-2.2.3\yourapp>play

        C:\Users\k.ashish\Downloads\play-2.2.3\play-2.2.3\yourapp>run

If you are not able to execute this command then set the play2.3 framework path in Environment variable in windows like java path .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM