OutofmemoryError:PermGen on play 2.2.2

时间:2014-05-27 03:28:16

标签: scala playframework-2.0 sbt typesafe-activator

我使用激活器(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源进行简单更改并再次单击该页面时,它会给我以下错误。

注意:我不确定这是否是使用激活器最初创建时从命令行运行播放应用程序的正确方法。

$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]

1 个答案:

答案 0 :(得分:0)

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

尝试将SBT_OPTS更改为包含 -XX:MaxPermSize=512M