SPRINGMVC Exception information ASM Classreader failed to parse class file problem solving

Source: Internet
Author: User

1. Environmental information:

Spring 3.2.0, JDK 1.8.0

2. Run a simple program and the following error message appears:

2. Run a simple program and the following error message appears:

  1. caused by: org.springframework.beans.factory.beandefinitionstoreexception:  Failed to read candidate component class: file [d:\newworkspace\ep-user\ target\test-classes\org\homework\ep\user\base\basetest.class]; nested exception is  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:\newworkspace\ep-user\target\ test-classes\org\homework\ep\user\base\basetest.class]; nested exception is  java.lang.illegalargumentexception  
  2. At Org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents ( classpathscanningcandidatecomponentprovider.java:290)
  3. At Org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan ( classpathbeandefinitionscanner.java:242)
  4. At Org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse ( componentscanbeandefinitionparser.java:84)
  5. At Org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse (namespacehandlersupport.java:73)
  6. At Org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement ( beandefinitionparserdelegate.java:1438)
  7. At Org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement ( beandefinitionparserdelegate.java:1428)
  8. At Org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions ( defaultbeandefinitiondocumentreader.java:185)
  9. At Org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions ( defaultbeandefinitiondocumentreader.java:139)
  10. At Org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions ( defaultbeandefinitiondocumentreader.java:108)
  11. At Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions ( xmlbeandefinitionreader.java:493)
  12. At Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions ( xmlbeandefinitionreader.java:390)
  13. At Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions ( xmlbeandefinitionreader.java:334)
  14. At Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions ( xmlbeandefinitionreader.java:302)
  15. At Org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions ( abstractbeandefinitionreader.java:174)
  16. At Org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions ( abstractbeandefinitionreader.java:209)
  17. At Org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions ( abstractbeandefinitionreader.java:180)
  18. At Org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions ( abstractbeandefinitionreader.java:243)
  19. At Org.springframework.test.context.support.AbstractGenericContextLoader.loadBeanDefinitions ( abstractgenericcontextloader.java:233)
  20. At Org.springframework.test.context.support.AbstractGenericContextLoader.loadContext ( abstractgenericcontextloader.java:117)
  21. At Org.springframework.test.context.support.AbstractGenericContextLoader.loadContext ( ABSTRACTGENERICCONTEXTLOADER.JAVA:60)
  22. At Org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading ( ABSTRACTDELEGATINGSMARTCONTEXTLOADER.JAVA:100)
  23. At Org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext ( abstractdelegatingsmartcontextloader.java:248)
  24. At Org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContextInternal ( CACHEAWARECONTEXTLOADERDELEGATE.JAVA:64)
  25. At Org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext ( cacheawarecontextloaderdelegate.java:91)
  26. ... More
  27. 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:\NewWorkSpace\ep-user\target\test-classes\org\homework\ep\ User\base\basetest.class]; Nested exception is java.lang.IllegalArgumentException
  28. At Org.springframework.core.type.classreading.SimpleMetadataReader. <init> (simplemetadatareader.java:56)
  29. At Org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader ( SIMPLEMETADATAREADERFACTORY.JAVA:80)
  30. At Org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader ( CACHINGMETADATAREADERFACTORY.JAVA:102)
  31. At Org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents ( classpathscanningcandidatecomponentprovider.java:266)
  32. ... More
  33. caused by:java.lang.IllegalArgumentException
  34. At Org.springframework.asm.ClassReader. <init> (Unknown Source)
  35. At Org.springframework.asm.ClassReader. <init> (Unknown Source)
  36. At Org.springframework.asm.ClassReader. <init> (Unknown Source)
  37. At Org.springframework.core.type.classreading.SimpleMetadataReader. <init> (simplemetadatareader.java:53)
  38. ... Wuyi more

3. Problem analysis

"ASM Classreader failed to parse class file" is one of the main reasons. Check MAVEN's class library, no problem found, no ASM explicit dependency, its dependency is generated by spring itself. Therefore, the analysis may be the problem caused by spring itself, but so popular spring, how can it be wrong, I can not so bull X encounter such a simple problem?

Is it a version? In addition to the version, Spring has no big difference. After a general search, there are really similar problems on the Internet:

  1. Note that the Java 8 bytecode level (-target 1.8, as required By-source 1.8) are only fully supported as of Spring Framewo RK 4.0.
  2. In particular, Spring 3.2 based applications need to BES compiled with a maximum of Java 7 as the target,
  3. Even if they happen to be deployed onto a Java 8 runtime.<span style= "font-family: arial,  ' Helvetica neue ',  helvetica, sans-serif;color: #222222;font-size: 15px;  Font-style: normal; font-variant: normal; font-weight: normal; letter-spacing:  normal; line-height: 19.5px; orphans: auto; text-align: left;  text-indent: 0px; text-transform: none; white-space: normal; widows: auto;  word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline ! Important; float: none; background-color: rgb (255, 249, 227); " >please upgrade to spring 4 for java 8 based  applications. </span>  

So, as you can see, there are two options:

A. Using Jdk7

B. Upgrading Spring 4

4. Problem solving

Finally, the upgrade Spring4.1.7 is selected, and then the problem is resolved.

SPRINGMVC Exception information ASM Classreader failed to parse class file problem solving

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.