Spring+Mybatis整合时Caused by: java.lang.IllegalArgumentException错误

org.springframework.beans.factory.BeanDefinitionStoreException: 
Failed to read candidate component class:
file [E:\workspace\spring_mybatis\bin\cn\gts\ssm\mapper\UserMapper.class];
nested exception is java.lang.IllegalArgumentException
org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.
findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:)

原因分析:

可以看到主要的错误信息是Caused by: java.lang.IllegalArgumentException,最后这个单词的意思是“非法的数据异常”,
主要原因是由于jdk版本和spring的相关jar包的版本有冲突,也就是,spring的版本过低和jdk8的版本会出现这个问题。
 
解决方案:
1,升级spring
1,1,我原来采用的是spring3.2.0的版本jdk8.0的版本,就出现了这个问题,然后我把spring的所有jar包都升级到了4.2.4的版本,然后测试正常。
 
1,2,我使用的JDK8,在JDK版本上面不要妥协,我也遇到过这个错误,mybatis用的3.2.7,spring我换成spring3.2.9或以上就OK了,
         当然,spring的最低运行版本我没测过
 
2,降jdk

ps:经过断点,发现在ClassReader(springcore.jar中的)类中出现了异常(读取:自动扫描mybatis的mapper代理接口类出错。)

spring3.2的源码包中没有该类,开发包中有该类的字节码。

这时候 问题来了 找了spring3..5的源码,在eclipse里面一个一个设置起来

最后发现下载的源码jar( org.springframework.asm-3.0..RELEASE.jar)竟然没有源码 全部是class

难道 我下载 错了?

又去折腾n久

发现 下的git源码还是jar源码 都是清一色没有asm源码

Spring基于ASM 2.2.3重新打包了spring-asm,包名变成org.springframework.asm.*,但是代码完全没有修改

将相应的类全部替换也可以正常运行

那么问题来了,是不是Spring是觉得把别人的代码放到自己项目里,感到不好意思,才不提供源代码的呢?

也许 只有他们自己才知道

顺便 吐槽下 spring 弄的下载方式实在太不人性了,现在基本只能git去官方下东西了

springcore源码中无asm

java.lang.IllegalArgumentException at org.springframework.asm.ClassReader.<init>(Unknown Source)

asm下载地址

 

Spring+Mybatis整合时 Failed to read candidate component class,Caused by:IllegalArgumentException的更多相关文章

  1. spring3.2.0与mybatis3.2.7整合出错--Failed to read candidate component class--nested exception is java.lang.IllegalArgumentException

    错误信息如下: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate com ...

  2. Spring + mybatis整合方案总结 结合实例应用

    Spring + mybatis整合实例应用 项目结构图 (Spring3.0.2 +mybatis3.0.4) 方案一: 通过配置文件整合Spring和mybatis 应用数据库 -- --数据库 ...

  3. Springmvc+Spring+Mybatis整合开发(架构搭建)

    Springmvc+Spring+Mybatis整合开发(架构搭建) 0.项目结构 Springmvc:web层 Spring:对象的容器 Mybatis:数据库持久化操作 1.导入所有需要的jar包 ...

  4. 3.springMVC+spring+Mybatis整合Demo(单表的增删该查,这里主要是贴代码,不多解释了)

    前面给大家讲了整合的思路和整合的过程,在这里就不在提了,直接把springMVC+spring+Mybatis整合的实例代码(单表的增删改查)贴给大家: 首先是目录结构: 仔细看看这个目录结构:我不详 ...

  5. spring在扫描包中的注解类时出现Failed to read candidate component错误

    出现:org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate componen ...

  6. SpringMVC+Spring+Mybatis整合

    SpringMVC+Spring+Mybatis整合 导包 配置jdbc.properties.log4j.properties jdbc.driver=com.mysql.jdbc.Driver j ...

  7. SSM 即所谓的 Spring MVC + Spring + MyBatis 整合开发。

    SSM 即所谓的 Spring MVC + Spring + MyBatis 整合开发.是目前企业开发比较流行的架构.代替了之前的SSH(Struts + Spring + Hibernate) 计划 ...

  8. spring 启动异常Failed to read candidate component class

    Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: ...

  9. Failed to read candidate component class错误分析

    org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component c ...

随机推荐

  1. Java 8 新日期时间 API

    Java 8 新日期时间 API 1. LocalDate.LocalTime.LocalDateTime LocalDate.LocalTime.LocalDateTime 实例是不可变的对象,分别 ...

  2. Dice 5 ==> dice 7

    https://github.com/Premiumlab/Python-for-Algorithms--Data-Structures--and-Interviews/blob/master/Moc ...

  3. 2018.10.02 bzoj4009: [HNOI2015]接水果(整体二分)

    传送门 整体二分好题. 考虑水果被盘子接住的条件. 不妨设水果表示的路径为(x1,y1)(x_1,y_1)(x1​,y1​),盘子表示的为(x2,y2)(x_2,y_2)(x2​,y2​) 不妨设df ...

  4. 2018.09.30 bzoj3551:Peaks加强版(dfs序+主席树+倍增+kruskal重构树)

    传送门 一道考察比较全面的题. 这道题又用到了熟悉的kruskal+倍增来查找询问区间的方法. 查到询问的子树之后就可以用dfs序+主席树统计答案了. 代码: #include<bits/std ...

  5. 打开yii2控制台命令

    1.在控制台中切换到yii2控制台入口文件的工作路径.如:C:\users\2016-01>D:www\blogdemo\yii

  6. ABP框架 - 缓存( 转)

    出处:http://www.cnblogs.com/kid1412/p/5987083.html 文档目录 本节内容: 简介 ICacheManager ICache ITypedCache 配置 实 ...

  7. LVDS_IP仿真分析

    这个一个对tx_outclock移相180度后的仿真结果. tx_outclock的时钟沿与数据中心对齐. tx_coreclock时钟与inclock时钟频率相等,但有相差.

  8. Spring3.x错误----NotFoundException: org.objectweb.asm.codevisitor

    Spring3.x错误: 解决办法: 一定要引入cglib-nodep-2.1_3.jar,而不是cglib-2.1.3.jar

  9. day4之内置函数、匿名函数,递归函数

    内置函数: https://www.processon.com/view/link/5adc6062e4b04721d63171eb?pw=3218 匿名函数:lambda lambda 语法: la ...

  10. 基于zookeeper的主备切换方法

    继承CZookeeperHelper即可快速实现主备切换: https://github.com/eyjian/libmooon/blob/master/include/mooon/net/zooke ...