ClassNotFoundException :org.springframework.web.util.Log4jConfigServlet
来源:互联网 发布:部队网络保密心得体会 编辑:程序博客网 时间:2024/06/06 03:25
,1、问题:
1、问题:
在Spring v4.1.7环境中配置log4j参数时,使用Servlet方式加载log4j.properties文件,发现出现下面的异常:
ClassNotFoundException :org.springframework.web.util.Log4jConfigServlet
在web.xml中使用下面的配置方式,将会报上述异常。
<context-param> <param-name>log4jConfigLocation</param-name> <param-value>WEB-INF/classes/log4j.properties</param-value> </context-param> <servlet> <servlet-name>log4jConfigListener</servlet-name><servlet-class>org.springframework.web.util.Log4jConfigServlet</servlet-class><load-on-startup>0</load-on-startup></servlet>
2、原因:
Spring v4.1.7版本的web包中已去掉了名为为Log4jConfigServlet的类,而在Spring v2.5.4中是存在该类的,但监听器类Log4jConfigListener还存在。
3、解决:
使用监听器方式实现。Spring v4.1.7 web包:spring-web-4.1.7.RELEASE.jar。
<context-param> <param-name>log4jConfigLocation</param-name> <param-value>WEB-INF/classes/log4j.properties</param-value> </context-param> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener>
参考:
1. log4j 几个技巧. http://blog.csdn.net/hongweigg/article/details/7085895.
0 0
- ClassNotFoundException :org.springframework.web.util.Log4jConfigServlet
- ClassNotFoundException: org.springframework.web.util.Log4jConfigLi
- java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
- java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
- java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener
- `java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener`
- java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener
- java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener
- java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener错误解决方案
- java.lang.ClassNotFoundException: org.springframework.web.util.WebAppRootListener
- 解决:java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
- java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener
- java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener
- ava.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
- java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener
- java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
- maven web 项目中启动报错java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
- maven web 项目中启动报错java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
- 奶牛的狂欢节
- SlidingMenu 常用属性介绍
- 视频(初)
- 友盟之微信授权登陆总结(微信授权回调响应问题)
- HDU 1027 全排列 (STL_permution)
- ClassNotFoundException :org.springframework.web.util.Log4jConfigServlet
- 短信发送器
- 关于A*算法的研究
- POJ水题1008Maya Calendar
- Linux串口详解
- Linux安装telnet
- 数星星
- timusoj 1748. The Most Complex Number (反素数&剪枝) 好题
- codeforces 604A Uncowed Forces