几个星期以来,我一直间歇性地遇到一个难以复制的问题。似乎(即我还不能确定)如果 Grails 应用程序没有在一夜之间被触及,那么可能会卸载某些东西导致:
GSP 使用以下值呈现:
<meta http-equiv="org.apache.commons.lang.StringUtils@72cd722b" content="org.apache.commons.lang.StringUtils@4e520b18">
<link href="/appname/static/bundle-bundle_application_head.css" type="org.apache.commons.lang.StringUtils@31da0262" rel="org.apache.commons.lang.StringUtils@774121fe" media="org.apache.commons.lang.StringUtils@6008482c" />
<body style="org.apache.commons.lang.StringUtils@49533701">
<a href="/appname/register/forgotPassword" name="org.apache.commons.lang.StringUtils@815a651" class="org.apache.commons.lang.StringUtils@5689bde">Forgotten Password?</a>
这发生在独立部署到 Tomcat 上,并且曾经让 Grails 在 IntelliJ 中过夜运行。
它不会每天晚上都发生,但在大多数情况下,我还无法找出工作和不工作之间的区别。
应用程序或 Tomcat 的日志中都没有提供线索。
此时我想知道它是否与资源插件有关。但是任何关于看什么的想法都值得赞赏
环境:
OS Win7 x64 and Redhat 5
Tomcat 7.0.x (also was occuring on latest Glassfish)
Grails 2.0.4
Plugins:
plugins.cache=1.0.0.RC1
plugins.cache-headers=1.1.5
plugins.compress=0.4
plugins.console=1.1
plugins.executor=0.3
plugins.export=1.3
plugins.fields=1.1
plugins.google-visualization=0.5.2
plugins.grails-melody=1.13
plugins.joda-time=1.4
plugins.mail=1.0
plugins.p6spy=0.5
plugins.quartz-monitor=0.2
plugins.spring-security-core=1.2.7.3
plugins.springcache=1.3.1
plugins.zipped-resources=1.0
更新#1:
本周末再次发生,在使用 Tomcat 管理器重新加载 webapp 时失败并显示以下消息,但这不会在 Tomcat 重新启动时发生:
INFO: Initializing Spring root WebApplicationContext
Jun 3, 2012 7:53:01 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName(Class.java:247)
... 3 more
Caused by: groovy.lang.MissingMethodException: No signature of method: static org.joda.time.DurationFieldType.hour() is applicable for argument types: () values: []
Possible solutions: hours(), wait(), days(), eras(), years(), any()
at grails.plugin.jodatime.taglib.PeriodTagLib$_getPeriodTypeForFields_closure3.doCall(PeriodTagLib.groovy:87)
at grails.plugin.jodatime.taglib.PeriodTagLib.getPeriodTypeForFields(PeriodTagLib.groovy:87)
at grails.plugin.jodatime.taglib.PeriodTagLib.<clinit>(PeriodTagLib.groovy:84)
... 4 more
我不相信,因为 jodaTime 插件中的代码看起来不错:
Line 84: private static final PeriodType DEFAULT_PERIOD_TYPE = getPeriodTypeForFields("hours,minutes,seconds")
private static PeriodType getPeriodTypeForFields(String fields) {
Line 87: def fieldTypes = fields.split(/\s*,\s*/).collect { DurationFieldType."$it"() } as DurationFieldType[]
更新#2
旋律显示慢慢地所有的物理内存都被吞噬了
如果重新加载应用程序,则可能与这些日志条目相关(并且始终强制 Tomcat 关闭并从挂起的 Java 进程开始被杀死)
SEVERE: The web application [/appname] appears to have started a thread named [Timer-1] but has failed to stop it. This is very likely to create a memory leak.
May 31, 2012 6:04:51 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/appname] appears to have started a thread named [DefaultQuartzScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak.
May 31, 2012 6:04:51 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
或者是这样的:http ://wiki.apache.org/tomcat/MemoryLeakProtection#cclThreadSpawnedByCommonClassLoader
更新#3
物理内存问题已解决,应用程序仍然损坏,看起来与原始帖子一样。这次空闲时间少了(几个小时)