【JUnit 报错】java.lang.IncompatibleClassChangeError

简介: 使用Junit 测试spring时候报错: 1 java.lang.IncompatibleClassChangeError: class org.springframework.core.LocalVariableTableParameterNameDiscoverer$ParameterNameDiscoveringVisitor has interface org.

使用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)
View Code

 

这个错误有个叫ClassMetadataReadingVisitor的类,以一个叫ClassVisitor的接口作为父类了。但是大家都知道,Java中类和接口的关系只能是实现,而不是继承。

那这就是架包的冲突了:

将这个架包移除 即可

相关文章
|
3月前
|
分布式计算 Java Hadoop
java使用hbase、hadoop报错举例
java使用hbase、hadoop报错举例
122 4
|
1月前
|
JSON Java 关系型数据库
Java更新数据库报错:Data truncation: Cannot create a JSON value from a string with CHARACTER SET 'binary'.
在Java中,使用mybatis-plus更新实体类对象到mysql,其中一个字段对应数据库中json数据类型,更新时报错:Data truncation: Cannot create a JSON value from a string with CHARACTER SET 'binary'.
77 4
Java更新数据库报错:Data truncation: Cannot create a JSON value from a string with CHARACTER SET 'binary'.
|
1月前
|
分布式计算 Java MaxCompute
ODPS MR节点跑graph连通分量计算代码报错java heap space如何解决
任务启动命令:jar -resources odps-graph-connect-family-2.0-SNAPSHOT.jar -classpath ./odps-graph-connect-family-2.0-SNAPSHOT.jar ConnectFamily 若是设置参数该如何设置
|
1月前
|
安全 小程序 Java
Java“AccessControlException”报错解决
Java中的“AccessControlException”通常发生在尝试访问受安全策略限制的资源时。解决方法包括:1. 检查安全策略文件(java.policy)配置;2. 确保代码具有足够的权限;3. 调整JVM启动参数以放宽安全限制。
160 1
|
3月前
|
消息中间件 分布式计算 Java
Linux环境下 java程序提交spark任务到Yarn报错
Linux环境下 java程序提交spark任务到Yarn报错
51 5
|
3月前
|
域名解析 分布式计算 网络协议
java遍历hdfs路径信息,报错EOFException
java遍历hdfs路径信息,报错EOFException
42 3
|
3月前
|
缓存 Java Linux
java操作hbase报错:KeeperErrorCode=NoNode for /hbase-unsecure/master
java操作hbase报错:KeeperErrorCode=NoNode for /hbase-unsecure/master
233 2
|
3月前
|
Java
java服务调用报错503
java服务调用报错503
39 2
|
3月前
|
JSON Java 数据格式
java调用服务报错400
java调用服务报错400
78 2
|
3月前
|
JSON Java 数据格式
java调用服务报错415 Content type ‘application/octet-stream‘ not supported
java调用服务报错415 Content type ‘application/octet-stream‘ not supported
113 1