[关闭]
@nextleaf 2018-05-22T14:32:00.000000Z 字数 1167 阅读 600

排错日志

1.缺少包2018-05-22

  1. Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/ReflectionManager
  2. at com.tjcsims.dao.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:13)
  3. at com.tjcsims.test.DBtest.test1(DBtest.java:26)
  4. at com.tjcsims.test.DBtest.main(DBtest.java:19)
  5. Caused by: java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.ReflectionManager

这是由于缺少Hibernate commons注释库引起的。

解决方法:

加入hibernate-commons-annotations-*.jar包
或构建路径,加入hibernate5.1的library

2. hibernate包和struts2包冲突

  1. NoSuchMethodError: antlr.collections.AST.getLine()I

解决办法

构建路径>库,移除hibernate和struts的依赖,复制tomcat对应项目的WEB-INF\lib\下的所有包
粘贴到项目的WebRoot\WEB-INF\lib并删除重复的包

3. findByCode方法中抛出DaoException("查询失败!", e)异常

  1. java.lang.NoClassDefFoundError: javassist/util/proxy/Proxy
  2. org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:123)
  3. ----------
  4. com.tjcsims.dao.DaoException: 查询失败!
  5. com.tjcsims.impl.LoginDaoImpl.findByCode(LoginDaoImpl.java:42)
  6. com.tjcsims.action.TeacherLoginAction.execute(TeacherLoginAction.java:26)

解决办法*

javassist包中要有Proxy类
将javassist-3.7.ga.jar替换为javassist-3.20.0-GA.jar,因为javassist-3.20.0-GA.jar中有Proxy类

4.ssss

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注