【问题标题】:OutofmemoryError: PermGen on play 2.2.2OutofmemoryError: PermGen on play 2.2.2
【发布时间】:2014-07-15 20:19:15
【问题描述】:

我使用激活器(Typesafe Activator 1.1.1)创建了一个简单的播放项目(hello-play)。

我的sbt 脚本看起来像

SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M" java $SBT_OPTS -jar `dirname $0`/sbt-launch.jar "$@"

当我运行 sbt play 时,我的服务器在 localhost:9000 上正确启动。但是,当我对我的一个 scala 源进行简单更改并再次单击该页面时,它给了我以下错误。

注意:我不确定这是否是在最初使用 activator 创建 play 应用程序时从命令行运行它的正确方法。

$sbt play
[info] Loading project definition from /Users/ssimanta/hello-play/project
[info] Set current project to hello-play (in build file:/Users/ssimanta/hello-play/)
       _
 _ __ | | __ _ _  _
| '_ \| |/ _' | || |
|  __/|_|\____|\__ /
|_|            |__/

play 2.2.2 built with Scala 2.10.3 (running Java 1.7.0_45), http://www.playframework.com

> Type "help play" or "license" for more information.
> Type "exit" or use Ctrl+D to leave this console.

[hello-play] $ run

--- (Running the application from SBT, auto-reloading is enabled) ---

[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Ctrl+D to stop and go back to the console...)

[info] Compiling 1 Scala source to /Users/ssimanta/hello-play/target/scala-2.10/classes...
[info] play - Application started (Dev)
[info] Compiling 1 Scala source to /Users/ssimanta/hello-play/target/scala-2.10/classes...
[error] application - 

! Internal server error, for (GET) [/message] ->

java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: PermGen space
    at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.7.0_45]
    at java.util.concurrent.FutureTask.get(FutureTask.java:188) ~[na:1.7.0_45]
    at sbt.ConcurrentRestrictions$$anon$4.take(ConcurrentRestrictions.scala:196) ~[na:na]
    at sbt.Execute.next$1(Execute.scala:88) ~[na:na]
    at sbt.Execute.processAll(Execute.scala:91) ~[na:na]
    at sbt.Execute.runKeep(Execute.scala:69) ~[na:na]
java.lang.OutOfMemoryError: PermGen space
    at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.7.0_45]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[na:1.7.0_45]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.7.0_45]
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) ~[na:1.7.0_45]
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71) ~[na:1.7.0_45]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.7.0_45]

【问题讨论】:

  • 你做了什么“简单的改变”?
  • 我更改了控制器方法之一返回的字符串getMessage

标签: scala playframework-2.0 sbt typesafe-activator


【解决方案1】:

MaxPermSize 在我的安装中的默认值为 512 MB。我认为可能需要这么多内存,尤其是对于某些模板。

尝试更改您的 SBT_OPTS 以包含 -XX:MaxPermSize=512M.

【讨论】:

  • 将其增加到 512 会导致相同的 PermGen 错误。
猜你喜欢
  • 2013-03-08
  • 2016-05-03
  • 1970-01-01
  • 1970-01-01
  • 2016-08-05
  • 1970-01-01
  • 2012-10-08
  • 2016-03-29
  • 2014-05-15
相关资源
最近更新 更多