今天在工作中遇到了下面的问题:

java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) ~[spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:101) ~[spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109) ~[spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) ~[spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:331) ~[spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:213) [spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:290) [spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-4.10.jar:na]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:292) [spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:233) [spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:87) [spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) [junit-4.10.jar:na]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) [junit-4.10.jar:na]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) [junit-4.10.jar:na]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) [junit-4.10.jar:na]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) [junit-4.10.jar:na]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) [spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:300) [junit-4.10.jar:na]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:176) [spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.junit.runner.JUnitCore.run(JUnitCore.java:157) [junit-4.10.jar:na]
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) [junit-rt.jar:na]
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) [junit-rt.jar:na]
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) [junit-rt.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_25]
at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_25]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) [idea_rt.jar:na]
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [D:\workspace\github\Timer\target\test-classes\com\rollenholt\timer\Demo.class]; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:301) ~[spring-context-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242) ~[spring-context-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:85) ~[spring-context-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1424) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1414) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:187) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:141) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:110) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:251) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.support.AbstractGenericContextLoader.loadBeanDefinitions(AbstractGenericContextLoader.java:253) ~[spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:122) ~[spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60) ~[spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:100) ~[spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:250) ~[spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContextInternal(CacheAwareContextLoaderDelegate.java:64) ~[spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:91) ~[spring-test-4.0.5.RELEASE.jar:4.0.5.RELEASE]
... 28 common frames omitted
Caused by: java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_25]
at java.lang.ClassLoader.defineClass(ClassLoader.java:760) ~[na:1.8.0_25]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_25]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455) ~[na:1.8.0_25]
at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_25]
at java.net.URLClassLoader$1.run(URLClassLoader.java:367) ~[na:1.8.0_25]
at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.8.0_25]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_25]
at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[na:1.8.0_25]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_25]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.8.0_25]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_25]
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_25]
at java.lang.ClassLoader.defineClass(ClassLoader.java:760) ~[na:1.8.0_25]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_25]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455) ~[na:1.8.0_25]
at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_25]
at java.net.URLClassLoader$1.run(URLClassLoader.java:367) ~[na:1.8.0_25]
at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.8.0_25]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_25]
at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[na:1.8.0_25]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_25]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.8.0_25]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_25]
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:63) ~[spring-core-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:82) ~[spring-core-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) ~[spring-core-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:277) ~[spring-context-4.0.5.RELEASE.jar:4.0.5.RELEASE]
... 51 common frames omitted

说实话根据这些异常信息一时半会还真没看出是什么原因引起的。Google后在Stackoverflow中发现了同样的问题.

链接地址:http://stackoverflow.com/questions/16209623/incompatibleclasschangeerror-class-classmetadatareadingvisitor-has-interface-cl

问题的原因是因为引入的Spring的版本不对。因为我引入的spring-core的版本是4.0.5.RELEASE,而引入的spring-asm的版本确为3.x的版本。因此版本不一致。

解决办法就是将两个的版本改为一致,我全部改为了4.0.5.RELEASE版本。然后问题解决了。

class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class的更多相关文章

  1. org.springframework.core.type.classreading.ClassMetadataReadingVisitor 异常

    今天项目启动的时候发现了一个异常: Exception in thread "main" org.springframework.beans.factory.BeanDefinit ...

  2. SpringMVC错误:nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.core.type.clas

    这是jar包冲突引起的 spring-core.jar已经有asm 所以不用再单独导入asm包了

  3. Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file

    springframework.version  3.2.6.RELEASE jdk 1.8

  4. Spring MVC 单元测试异常 Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file

    Sping 3.2.8.RELEASE + sping mvc + JDK 1.8运行异常. java.lang.IllegalStateException: Failed to load Appli ...

  5. spring异步执行报异常No qualifying bean of type 'org.springframework.core.task.TaskExecutor' available

    最近观察项目运行日志的时候突然发现了一个异常, [2018-04-03 10:49:07] 100.0.1.246 http-nio-8080-exec-9 DEBUG org.springframe ...

  6. org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'null' to required type 'double' for property 'band'; nested exception is org.springframework.core.convert.Con

    本文为博主原创,未经允许不得转载: 先将异常粘贴出来: 20:37:26,909 ERROR [com.suning.fucdn.controller.ProductDataStaticsContro ...

  7. maven构建spring报错org.springframework.core.NestedRuntimeException cannot be resolved.

    Error:The type org.springframework.core.NestedRuntimeException cannot be resolved. It is indirectly ...

  8. SpringCloud项目启动报错:NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable

    报错表象: 当启动SpringClud项目报错: Exception in thread "main" java.lang.NoClassDefFoundError: org/sp ...

  9. java-org.springframework.core.convert.ConversionFailedException- 前端传string解析date异常

    关于SpringMVC前台日期作为实体类对象参数类型转换错误解决 异常信息: Field error in object 'tblHouse' on field 'houseTime': reject ...

随机推荐

  1. 扩展 easyui 控件系列:为datagrid 增加过滤行

    此功能还为真正完成,起到抛砖引玉的效果,发动大家的力量把这个功能完善起来,效果图如下: 基本上就是扩展了 datagrid.view 中的onAfterRender 这个事件,具体代码如下: $.ex ...

  2. 流形学习之等距特征映射(Isomap)

    感觉是有很久没有回到博客园,发现自己辛苦写的博客都被别人不加转载的复制粘贴过去真的心塞,不过乐观如我,说明做了一点点东西,不至于太蠢,能帮人最好.回校做毕设,专心研究多流形学习方法,生出了考研的决心. ...

  3. async 更优雅异步体验

    上一篇<让 Generator 自启动>介绍了通过起动器让 Generator 跑起来,而本篇采用 async 实现更优雅的异步编程. 从例子开始 借用上一篇例子中的例子说起. funct ...

  4. 用c#操作Mongodb(附demo)

    因为需要,写了一个基于泛型的helper,这样要使用起来方便一点. 为了大家也不重复造轮子,所以发出来希望能帮到谁. 复杂的查询最好用linq,这也是mongodb官方建议的. mongodb的C#配 ...

  5. 解决问题:由于扩展配置问题而无法提供您请求的页面。如果该页面是脚本,请添加处理程序。如果应下载文件,请添加 MIME 映射。

    WindowServer2012服务器,添加角色安装完.netframework和iis之后,运行aspx页面就报如下错误: HTTP 错误 404.3 - Not Found 由于扩展配置问题而无法 ...

  6. Android闹钟开发与展示Demo

    前言: 看过了不少安卓闹钟开发的例子,都是点到为止,都不完整,这次整一个看看. 一.闹钟的设置不需要数据库,但是展示闹钟列表的时候需要,所以需要数据库: public class MySQLiteOp ...

  7. MVC认知路【点点滴滴支离破碎】【五】----form表单上传单个文件

    //个人理解:前台一个form加input[type='file'],在加一个submit的按钮 主要设置form的action,method,enctype='multipart/form-data ...

  8. window php redis扩展下载地址

    redis扩展下载 http://windows.php.net/downloads/pecl/snaps/redis/

  9. 开发错误记录11:git报错 fatal:open /dev/null or dup failed: No such file or directory

    今天在自己的的电脑上装了git,没成想运行报错: 重装了几次git ,都不行,电脑上没有装github桌面版; 后来在网上查到了方法,反映这是系统的问题: null是比较特殊的系统文件,它实际上是为操 ...

  10. 关于如何调用苹果自带的地图APP

    CLGeocoder *geoCoder = [[CLGeocoder alloc] init]; // 通过地理编码,得到位置, CLLocation *loc = [[CLLocation all ...