我遇到了一個我正在工作的grails應用程序的問題,我無法弄清楚。 這是一個Grails 2.0應用程序,應該在Tomcat7上運行在Debian stable上。所以我構建了war文件並將其部署到Tomcat。當我啓動它,我得到在Tomcat日誌文件以下日誌輸出(catalina.out中):當試圖在Tomcat中啓動grails應用程序時出現「SEVERE:Error listenerStart」
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.
我試圖通過增加雄貓日誌級別爲FINEST使輸出多一點冗長,但那並不是」給我任何更多的信息。此外,我改變了應用程序的日誌級別進行調試,但這也沒有幫助。
在我的本地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中
進口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 = {}
}
可能有多種原因,最有可能的原因是插件依賴性需要servlet 3.0 API,它只適用於tomcat 7.請提供您的BuildConfig.groovy和您的application.properties – Chris 2012-01-28 14:39:11
我也在休眠無法連接到數據庫。你應該打開應用程序的日誌級別來記錄grails類。 – chrislovecnm 2012-01-28 19:12:43
@chrislovecnm:我試過了,並把它們全部調試,但應用程序沒有記錄任何東西。 – Moritz 2012-01-30 17:00:46