_宁静 2017-05-08 11:18 采纳率: 100%
浏览 5275
已采纳

spring使用各种注解报错

使用Spring框架时,使用注解就报错.

 Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [D:\Eclipse Luna4.4\eclipse\workspace\testWeb\build\classes\test\A.class]; nested exception is java.lang.IllegalArgumentException
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:56)
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
    at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:266)
    ... 24 more
Caused by: java.lang.IllegalArgumentException
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:53)
    ... 27 more

事情是这样的,本来使用eclipse4.6.1版本的,使用注释没有问题,后来写SpringMVC配置ok后启动tomcat就报错(不用注释),我就重新下了个4.4.2版本的eclipse,运行可以通过,但是现在发现,这个版本的eclipse使用注解就报错,包括注解注入、组件扫描等.请问这到底是什么问题,?

代码+jar包都是一样的.

  • 写回答

3条回答

  • _宁静 2017-05-08 13:42
    关注

    查了半天.发现是jdk与Spring不兼容导致的.我的是jdk8,用Spring4就解决问题了.遇到相同问题的兄弟不妨看看咯.避免去浪费不必要的时间

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗