标签:
使用Junit 测试spring时候报错:
1 java.lang.IncompatibleClassChangeError: class org.springframework.core.LocalVariableTableParameterNameDiscoverer$ParameterNameDiscoveringVisitor has interface org.springframework.asm.ClassVisitor as super class 2 at java.lang.ClassLoader.defineClass1(Native Method) 3 at java.lang.ClassLoader.defineClass(ClassLoader.java:800) 4 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) 5 at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) 6 at java.net.URLClassLoader.access$100(URLClassLoader.java:71) 7 at java.net.URLClassLoader$1.run(URLClassLoader.java:361) 8 at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 9 at java.security.AccessController.doPrivileged(Native Method) 10 at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 11 at java.lang.ClassLoader.loadClass(ClassLoader.java:425) 12 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 13 at java.lang.ClassLoader.loadClass(ClassLoader.java:358) 14 at org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:114) 15 at org.springframework.core.LocalVariableTableParameterNameDiscoverer.getParameterNames(LocalVariableTableParameterNameDiscoverer.java:87) 16 at org.springframework.core.PrioritizedParameterNameDiscoverer.getParameterNames(PrioritizedParameterNameDiscoverer.java:65) 17 at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:182) 18 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) 19 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) 20 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) 21 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) 22 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 23 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 24 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 25 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 26 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) 27 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) 28 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) 29 at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140) 30 at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84) 31 at com.it.sxd.SayHelloTest2.testSayHello(SayHelloTest2.java:11) 32 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 33 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 34 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 35 at java.lang.reflect.Method.invoke(Method.java:606) 36 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) 37 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 38 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) 39 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) 40 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) 41 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) 42 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) 43 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 44 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 45 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 46 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 47 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 48 at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 49 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) 50 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 51 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 52 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) 53 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 54 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
这个错误有个叫ClassMetadataReadingVisitor的类,以一个叫ClassVisitor的接口作为父类了。但是大家都知道,Java中类和接口的关系只能是实现,而不是继承。
那这就是架包的冲突了:
将这个架包移除 即可
【JUnit 报错】java.lang.IncompatibleClassChangeError
标签:
原文地址:http://www.cnblogs.com/sxdcgaq8080/p/5651155.html