异常错误集锦

1、spring配置声明式事务时出现异常:Caused by: java.lang.ClassNotFoundException: org.springframework.core.annotation.AnnotatedElementUtils

原因:此类在spring4.0中才有,项目中可能有显示或隐式的引用了spring-tx4.0。而项目中配置的spring版本是4.0以下,因此会找不到此类

本例中引用了spring-data-redis:jar:1.4.1.RELEASE,而这个包又引用了spring-tx:jar:4.0.7.RELEASE。类似可用mvn dependency:tree命令排查错误。

解决办法:显式的引用spring-orm包即可,如:

 

<dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-orm</artifactId>
          <version>3.0.5.RELEASE</version>
</dependency>

2、

posted @ 2015-06-18 10:12  hejinsheng  阅读(336)  评论(0编辑  收藏  举报