0

我正在尝试将我的 Grails 2.1.1 应用程序部署到 cloudfoundry.com。在我的本地计算机上,应用程序运行没有问题。从 BuildConfig.groovy 中删除 Quartz 插件依赖项时,我能够成功启动 cloudfoundry 上的应用程序。

依赖:

compile ":quartz:1.0-RC5"

grails cf-logs 打印以下错误:

Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space

下面看我的工作:

package de.tum.wi.fm.game
import org.quartz.JobExecutionContext

class StartGameJob {
    def execute(JobExecutionContext context) {
        def gameRoundId = context.mergedJobDataMap.get('gameRoundId')

        if(gameRoundId) {
            GameRound gameRound = GameRound.get(gameRoundId)
            if(gameRound) {
                Game game = gameRound?.game
                game.currentGameRound = gameRound
                game.save(flush: true)
            }
        }
    }
}

触发器放置在服务中:

def jobParams = [gameRoundId:gameRound.id]
Date gameRoundEndDate = gameRound.endDate.toDate()
ChangeRoundJob.schedule(gameRoundEndDate, jobParams)
4

2 回答 2

0

您是否尝试过为应用程序分配更多内存?您可以使用 VMC 执行此操作;

vmc scale [application name]

按照提示操作,VMC 应该会询问您希望分配多少内存。

于 2013-02-02T19:54:42.843 回答
0

The OutOfMemoryError exception determines that the JVM hasn't enough memory assigned. You need to increase the memory of cloudfoundry instance and consequently increase memory of the JVM.

Try to execute following commands when deploying your application:

grails -Dgrails.env=production cf-push --memory=2048 --no-start
grails -Dgrails.env=production cf-env-add JAVA_OPTS -Xmx1024m -XX:MaxPermSize=512m
grails -Dgrails.env=production cf-start

The first command will push (deploy) the application into the cloudfoundry instance and doesn't start it.

The second will set JVM environment variables, sufficient memory settings.

Third command starts the application.

于 2013-02-06T09:47:54.577 回答