【问题标题】:Play Framework Run Application IssuePlay Framework 运行应用程序问题
【发布时间】:2012-06-17 14:15:49
【问题描述】:

每当我尝试运行使用 Play 创建的新 Web 应用程序时,我都会收到以下错误。

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.

【问题讨论】:

  • 传递给应用程序的参数是什么?像这样的东西? -Xms256m -Xmx512m -XX:PermSize=64M -XX:MaxPermSize=1000M。如果是这样,请删除或减小 Xms 和 -XX:PermSize 的值

标签: java frameworks playframework


【解决方案1】:

在 Play framework 2.0.3 中,<play framework install dir>\framework\build.bat 脚本需要替换下面命令的命令行参数

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" %*

【讨论】:

  • 从 2.0.x 迁移到 2.1 仍然有效
  • 为什么我们需要这样做?我的意思是......一个刚刚完成安装 Play,创建一个新项目,并尝试运行它和 KABOOM!错误...怎么了?问题的原因是什么?
  • 这适用于我在 Windows 7 64 位上使用版本 play-2.2.1。问题是为什么一年后我还需要这样做?
【解决方案2】:

刚刚在我的 Windows 8 计算机上下载并解压缩了 2.2.1。

按照 Play Framework 网站上的文档进行操作,最终遇到了与您相同的问题。调整构建文件中的各种参数并没有做任何事情,但是:

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" %*

...解决了这个问题。 我不知道其他人在哪里找到了这个解决方案,但是 Play Framework 网站上没有提到这个解决方案。事实上,没有任何迹象表明任何事情都可能出错。毕竟只是一个需要解压的文件。

它现在正在运行,但是要相信一个早早搞砸的框架有点难以相信。似乎作者只在 Linux 上进行了测试。

【讨论】:

    【解决方案3】:

    在 2.3 播放框架中:

        GO to : 
    

    C://Play2.3/framework/build.bat 并打开此文件并进行这些更改。 将此行替换为以下行。

    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" %*

    然后在命令提示符上键入此命令:

           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
    

    如果无法执行此命令,则在windows环境变量中设置play2.3框架路径,如java路径。

    【讨论】:

      猜你喜欢
      • 2015-04-19
      • 2015-01-25
      • 2011-09-07
      • 1970-01-01
      • 1970-01-01
      • 2012-06-22
      • 2017-03-06
      • 1970-01-01
      • 2014-12-28
      相关资源
      最近更新 更多