CloudFoundry 上的 Grails 应用程序不会重新启动
Posted
技术标签:
【中文标题】CloudFoundry 上的 Grails 应用程序不会重新启动【英文标题】:Grails app on CloudFoundry will not restart 【发布时间】:2012-10-10 15:00:22 【问题描述】:我正在使用 STS 将 Grails 应用程序部署到 CloudFoundry。一切都很顺利,进行编辑并执行“更新并重新启动”。突然之间,我开始遇到应用程序无法成功重启的问题。以下是日志显示的内容:
Oct 10, 2012 2:18:31 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-6401
Oct 10, 2012 2:18:31 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 380 ms
Oct 10, 2012 2:18:31 PM org.apache.catalina.realm.JAASRealm setContainer
INFO: Set JAAS app name Catalina
Oct 10, 2012 2:18:31 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Oct 10, 2012 2:18:31 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
Oct 10, 2012 2:18:31 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Oct 10, 2012 2:18:43 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Oct 10, 2012 2:18:43 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [net.sf.ehcache.CacheManager@2ff7ac92] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [com.lossless.S2Role.data] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [org.hibernate.cache.UpdateTimestampsCache.data] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [org.hibernate.cache.StandardQueryCache.data] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [quartzScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [quartzScheduler_Worker-2] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [quartzScheduler_Worker-3] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [quartzScheduler_Worker-4] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [quartzScheduler_Worker-5] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [quartzScheduler_Worker-6] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [quartzScheduler_Worker-7] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [quartzScheduler_Worker-8] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [quartzScheduler_Worker-9] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [quartzScheduler_Worker-10] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [quartzScheduler_QuartzSchedulerThread] but has failed to stop it. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Actual transaction active]) and a value of type [java.lang.Boolean] (value [true]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Transactional resources]) and a value of type [java.util.HashMap] (value [org.apache.commons.dbcp.BasicDataSource@19129103=org.springframework.jdbc.datasource.ConnectionHolder@1251dee1, org.hibernate.impl.SessionFactoryImpl@21faa3c5=org.springframework.orm.hibernate3.SessionHolder@3cff8f2c]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Current transaction name]) and a value of type [java.lang.String] (value [lossless.MarketScannerJob.execute]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Current aspect-driven transaction]) and a value of type [org.springframework.transaction.interceptor.TransactionAspectSupport.TransactionInfo] (value [PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '']) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Oct 10, 2012 2:18:43 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Transaction synchronizations]) and a value of type [java.util.LinkedHashSet] (value [[]]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
....
Stopping Tomcat because the context stopped.
我尝试删除该应用程序,但没有帮助。我尝试删除应用程序和数据库,但没有帮助。昨晚终于奏效的是创建一个具有不同名称的新数据库。今天,我又回到了同样的问题。
我不确定问题出现的时间,但可能与我添加 Quartz 插件并创建工作时有关。
显然,我无法在每次更改应用程序时都重新创建新数据库。
我该如何解决这个问题?
感谢您的建议!这让我发疯了。
【问题讨论】:
【参考方案1】:我在使用 Grails 和石英插件时遇到了问题。
当我通过grails install quatz-plugin
命令行安装插件时,它在 grails-app 下创建了一个名为 Jobs 的文件夹,并在那里添加了它的源,但 STS 没有将其识别为源的有效文件夹,并且它每次都会使我的应用崩溃一次我尝试使用它
在我的情况下,工作文件夹下
grails-app/jobs
未在 STS 中列为源文件夹,因此在应用程序启动时请求作业时应用程序正在死机。
【讨论】:
不,应用程序在我的机器上可以正常启动,并且工作肯定会运行。 (但我没有给你-1。):-) 但是你确实有道理。同样的事情确实发生在我身上,我从来没有想过将它添加为源文件夹。因为我意识到它在 grails-apps 下,所以我只是导航到它。但现在我要把它添加到源文件夹列表中。【参考方案2】:事实证明,由于一些级联问题,我在 Bootstrap 执行期间遇到了这个异常。
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing
部分问题是我看不到错误。发现此类问题的一个非常有用的标志是 failOnError:
o.save(failOnError:true)
一旦我将该标志添加到我的 save() 调用中,我就可以看到异常。一旦我摆脱了异常,我的应用程序又开始运行了,我现在也可以更新和重新启动了。
还有一个使用 CloudFoundry 的实用技巧。这些命令可让您列出日志文件:
vmc files <appname> logs
vmc files <appname> tomcat/logs
这些命令可让您查看日志文件的内容:
vmc files <appname> logs/stdout.log
vmc files <appname> logs/stderr.log
vmc files <appname> tomcat/logs/localhost.2012-10-11.log
vmc files <appname> tomcat/logs/catalina.2012-10-11.log
我希望这对某人有所帮助。它确实帮助了我。
【讨论】:
我刚刚又遇到了同样的问题,即使清除应用程序和服务并开始清理也无法解决它。在深入研究我在 logs/stdout.log 中发现的异常时,有些东西并没有加起来。这导致我在 STS 中进行了 CLEAN。一旦我这样做了,重新部署最终一直按预期工作。以上是关于CloudFoundry 上的 Grails 应用程序不会重新启动的主要内容,如果未能解决你的问题,请参考以下文章
错误 310:暂存部署失败 - Cloud Foundry 中的 Grails 应用程序