[SpringMVC]ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
2013-07-23 10:01
483 查看
ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
1.有可能是web.xml下的配置不正确. 检查确认无误2.第二种可能:包没有导入到tomcat下.
我导入后可以发布成功. 但是仔细看发布信息
有这样一段信息:
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
解决方案: 1.网上有一种说法是:把ContextLoaderListener改为SpringContextServlet.其实可以试试.
2.下面主要说一下第二种方案.
在web.xml中加入:
<context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/config/log4j.properties</param-value> </context-param>
<!-- 定义LOG4J监听器 --> <listener> <listener-class> org.springframework.web.util.Log4jConfigListener </listener-class> </listener>
log4j.properties代码如下:
# Set root logger level to error log4j.rootLogger=INFO, Console, File ###### Console appender definition ####### # All outputs currently set to be a ConsoleAppender. log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{3}] %m%n #log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n ###### File appender definition ####### log4j.appender.File=org.apache.log4j.DailyRollingFileAppender log4j.appender.File.File=spring.log log4j.appender.File.Append=false log4j.appender.File.layout=org.apache.log4j.PatternLayout log4j.appender.File.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
具体是什么原因我也不知道. ╮(╯▽╰)╭
相关文章推荐
- SpringMVC常见问题java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- IDEA调试SpringMvc项目时,出错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener,解决办法
- SpringMVC 出现ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- idea调试SpringMvc, 出现:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- tomcat启动报错java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- Tomcat 启动报java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 异常
- 使用Maven报错 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- Java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- maven 项目出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener问题解决
- [Spring常见问题]java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- maven 项目出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener错误解决方案
- maven项目报java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener错误解决方案
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener