Reputation: 499
I have a problem with a grails app I'm working on and I can't figure it out. It's a grails 2.0 app that should run on a Debian stable with a Tomcat7. So I built the war file and deployed it to the Tomcat. As soon as I start it, I get the following log output in the Tomcat logfile (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.
I tried making the output a little more verbose by increasing the Tomcats loglevel to FINEST but that doesn't give me any more information. Also I changed the app's loglevel to debug, but that doesn't help either.
On my local Tomcat everything works fine with the same war and a 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 = {}
}
Upvotes: 12
Views: 12473
Reputation: 7371
I was getting the same error, but I found the following article:
In resume, you need to create a logging.properties file in your WEB-INF/classes (you can add it to exploded folder inside webapps and restart tomcat)
The content of logging.properties can be:
org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler
After restart Tomcat you can see more detailed errors.
Upvotes: 25
Reputation: 2471
I've had the same type of error in Tomcat7. I found that if I followed the instructions on converting Tomcat to use log4j it could capture the early errors to the logs, but with the default Tomcat config if an error occurs early in the startup process of the Grails app the "Error listenerStart" is all you get.
Some sources of this:
Upvotes: 5