尝试在Tomcat中启动grails App时出现“SEVERE:Error listenerStart”

时间:2012-01-28 12:13:52

标签: tomcat grails debian

我遇到了一个我正在处理的grails应用程序的问题,我无法弄明白。 这是一个grails 2.0应用程序,应该在带有Tomcat7的Debian稳定版上运行。所以我构建了war文件并将其部署到Tomcat。一旦启动它,我就会在Tomcat日志文件(catalina.out)中获得以下日志输出:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
28-Jan-2012 13:02:00 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
28-Jan-2012 13:02:00 org.apache.catalina.core.StandardContext start
SEVERE: Context [/Gibbons5] startup failed due to previous errors
28-Jan-2012 13:02:00 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/Gibbons5] registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

我尝试通过将Tomcats loglevel增加到FINEST来使输出更加冗长,但这并没有给我任何更多信息。我还将应用程序的loglevel更改为debug,但这也无济于事。

在我的本地Tomcat上,一切运行良好,同样的战争和Tomcat7。

BuildConfig.groovy

grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
    }
    log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    repositories {
        grailsPlugins()
        grailsHome()
        grailsCentral()
        mavenCentral()
    }
    dependencies {
        compile "org.jadira.usertype:usertype.jodatime:1.9"
        runtime 'mysql:mysql-connector-java:5.1.18'
    }
}

codenarc.reports = {
    XMLReport('xml') {
        outputFile = 'CodeNarcReport.xml'
        title = 'Gibbons5'
    }
    HTMLReport('html') {
    outputFile = 'CodeNarcReport.html'
        title = 'Gibbons5'
        }
}
codenarc.propertiesFile = 'codenarc.properties'

// cobertura exclusions
coverage {
    exclusions = [
        '**/BuildConfig*',
        '**/*SecurityConfig*'
    ]
}

application.properties

#Grails Metadata file
#Tue Jan 03 23:21:41 CET 2012
app.context=/
app.grails.version=2.0.0
app.name=Gibbons5
app.servlet.version=2.5
app.version=0.1
plugins.burning-image=0.5.0
plugins.code-coverage=1.2.5
plugins.codenarc=0.16.1
plugins.hibernate=2.0.0
plugins.joda-time=1.3.BUILD-SNAPSHOT
plugins.jquery=1.7.1
plugins.svn=1.0.1
plugins.syntax-highlighter=0.1.4
plugins.tomcat=2.0.0

BootStrap.groovy中

import grails.util.GrailsUtil

class BootStrap {

    def baseDataGenerator

    def init = { servletContext ->
        switch (GrailsUtil.environment) {
            case 'development':
                log.debug("init() - booting as development")

                baseDataGenerator.generateData()

                break

            case 'production':
                log.info("init() - booting as production")

                baseDataGenerator.generateData()

                break

            case 'test':
                log.debug("init() - booting as test")

                baseDataGenerator.generateData()

                break

            default:
                log.warn("init() - uncovered environment " + GrailsUtil.environment)
        }
    }

    def destroy = {}
}

2 个答案:

答案 0 :(得分:25)

我遇到了同样的错误,但我发现了以下文章:

http://mythinkpond.wordpress.com/2011/07/01/tomcat-6-infamous-severe-error-listenerstart-message-how-to-debug-this-error/

在简历中,您需要在WEB-INF / classes中创建logging.properties文件(您可以将其添加到webapps中的爆炸文件夹并重新启动tomcat)

logging.properties的内容可以是:

org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler

重启Tomcat后,您可以看到更详细的错误。

答案 1 :(得分:5)

我在Tomcat7中遇到了同样的错误。我发现,如果我按照转换Tomcat使用log4j的说明,它可以捕获日志中的早期错误,但如果在Grails应用程序启动过程的早期发生错误,则使用默认的Tomcat配置,“Error listenerStart”全部你明白了。

有些消息来源:

  1. 数据源设置为dbCreate:validate,并且数据库与GORM域类不同步。
  2. BootStrap.groovy中的错误,主要与尝试自动创建由于之前运行而已存在的域对象有关。
  3. 其他配置错误(不太可能。