1. 程式人生 > >Spring版本過低問題

Spring版本過低問題

  1.  環境資訊:
    1. Spring 3.2.10, JDK 1.8, hibernate 4
  2. 錯誤提示

Caused by:org.springframework.beans.factory.BeanDefinitionStoreException:Failedtoreadcandidatecomponentclass:file[D:\NewWorkSpace\ep-user\target\test-classes\org\homework\ep\user\base\BaseTest.class]; nested exception is org.springframework.core.NestedIOException: ASM

ClassReaderfailedtoparseclassfile - probably due to a new Java class file version that isn't supported yet: file [D:\NewWorkSpace\ep-user\target\test-classes\org\homework\ep\user\base\BaseTest.class]; nested exception is java.lang.IllegalArgumentException  

    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:290)  

..............

  1. 問題分析
    1. ASM ClassReader failed to parse class file”黃色高亮是其中主要的原因。
    2. 原因是,如果使用JDK8,那麼springJAR包最低版本為4.0以上!
  2. 解決方案
    1. 使用jdk7
    2. 升級Springjar包為4.0以上!