hibernate与struts2一起时的异常处理
来源:互联网 发布:java培训有哪些骗局 编辑:程序博客网 时间:2024/06/04 19:38
今天项目刚将hibernate与struts2放一起。异常还不少。
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...log4j:WARN No appenders could be found for logger (freemarker.cache).
解决:Log4j2以上版本需要放在log4j-的jar包和log4j-core核心包。
java.lang.NoSuchMethodError: org.apache.logging.log4j.status.StatusLogger.debug(Ljava/lang/String;Ljava/lang/Object;)
commons-logger.jar和你的log4j.jar版本不兼容。前者是对后者的一个封装,而hibernate中主要是使用前者。前者的功能就是:它封装了一些通常的日志类,比如log4j,java.util.logging.Logger 等,使用的log4j,但是由于版本不对,commons-logger中用了log4j中的那个类,在当前的log4j版本中已经不存在了,所以报错
/hibernate.cfg.xml not found
解决:如果之前的hibernate都能正常运行,那么出现这种情况时,将hibernate放在src下面即可。
An AnnotationConfiguration instance is required to use <mapping class="entity.District"/>
解决:很明显。用了注解。4.0版本之前记得在配置前用:
new AnnotationConfiguration().configure();
4.0之后的hibernate改用注册的方法了,不存在这个问题了。
0 0
- hibernate与struts2一起时的异常处理
- struts2之使用JSON插件实现Ajax(处理hibernate的POJO类时出现的异常)
- struts2的异常处理
- Struts2的异常处理
- Struts2的异常处理
- struts2的异常处理
- Struts2的异常处理机制
- Struts2的异常处理机制
- Struts2的异常处理机制
- Struts2.1的异常处理
- SSH-struts2的异常处理
- Struts2的异常处理机制
- Struts2的异常处理机制
- struts2框架的异常处理
- Struts2的异常处理框架
- 配置Struts2的异常处理
- JavaEE struts2的异常处理
- Struts2的异常处理机制
- Visual C++
- 蓝桥杯 ADV-193算法提高 盾神与条状项链
- Codeforces Round #206 (Div. 2) C-Vasya and Robot
- 蓝桥杯 ALGO-29 算法训练 校门外的树(区间处理)
- Poj1611 The Suspects 并查集基础题
- hibernate与struts2一起时的异常处理
- 蓝桥杯 ALGO-11算法训练 瓷砖铺放(递归/动态规划)
- [C#]银行家算法的实现
- [LeetCode] 49. Group Anagrams
- 蓝桥杯ADV-17算法提高 统计单词数
- Codeforces 599B: Spongebob and Joke(技巧,规律)
- Another kind of Fibonacci(hdu3306)矩阵快速幂
- 小白学习python之路-----笔记(一)
- AspectJ的切入点表达式---execution表达式详解