0

我正在使用 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 插件并创建工作时有关。

显然,我无法在每次更改应用程序时都重新创建新数据库。

我该如何解决这个问题?

感谢您的任何建议!这让我发疯了。

4

2 回答 2

1

事实证明,由于一些级联问题,我在 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

我希望这可以帮助别人。它确实帮助了我。

于 2012-10-11T02:23:21.993 回答
1

我遇到了 Grails 和石英插件的问题。

当我通过命令行安装插件时grails install quatz-plugin,它在 grails-app 下创建了一个名为 Jobs 的文件夹,并在那里添加了它的源,但是 STS 没有将其识别为源的有效文件夹,并且每次我尝试使用时它都会使我的应用崩溃它

在我的情况下,工作文件夹下

grails-app/jobs

未在 STS 中列为源文件夹,因此在应用程序启动时请求作业时应用程序正在死亡。

于 2012-10-10T15:06:43.597 回答