Friday, November 19, 2010

Log4J problem after deployment to Tomcat

The problem not happens on STS with Jetty.

By mistype a log statement, instead of:
log.debug("....")
typed
Log.debug("...."), oops that's wrong!!
this was the cause for an exception on the tomcat server:

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org.mortbay.log.Log
org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:318)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:293)
org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:269)
org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:261)
org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter.doFilterInternal(UrlMappingsFilter.java:181)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.obtainContent(GrailsPageFilter.java:171)
org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.doFilter(GrailsPageFilter.java:110)
org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:65)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
root cause
java.lang.NoClassDefFoundError: org.mortbay.log.Log
SocService$_save_closure1.class$(SocService.groovy)
SocService$_save_closure1.$get$$class$org$mortbay$log$Log(SocService.groovy)
SocService$_save_closure1.doCall(SocService.groovy:86)
SocService.save(SocService.groovy:44)
SocService$$FastClassByCGLIB$$830c874e.invoke()
net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
SocService$$EnhancerByCGLIB$$277a9fbf.save()
SocService$save.call(Unknown Source)
DocumentEditController$_closure2_closure33_closure117.doCall(DocumentEditController.groovy:997)


Config.groovy entries:
// log4j configuration
log4j = {
appenders {
console name: 'stdout', layout: pattern(conversionPattern:'%d{[dd.MM.yy HH:mm:ss.SSS]} %-5p %c{2} %x - %m%n')
rollingFile name: 'file', layout: pattern(conversionPattern:'%d{[dd.MM.yy HH:mm:ss.SSS]} %-5p %c{2} %x - %m%n'), file: 'fab.log'
}
root {
error()
additivity = true
}

error 'org.codehaus.groovy.grails.web.servlet', // controllers
'org.codehaus.groovy.grails.web.pages', // GSP
'org.codehaus.groovy.grails.web.sitemesh', // layouts
'org.codehaus.groovy.grails."web.mapping.filter', // URL mapping
'org.codehaus.groovy.grails."web.mapping', // URL mapping
'org.codehaus.groovy.grails.commons', // core / classloading
'org.codehaus.groovy.grails.plugins', // plugins
'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
'org.springframework',
'org.hibernate'

debug file:['grails.app']
'org.hibernate'
//stdout:'grails.app'

warn 'org.mortbay.log'

}

No comments: