`

Dealing with java.lang.NoSuchMethod when using spring testing framework

阅读更多
The discription of the cause of the problem:
java.lang.NoSuchMethodError: org/springframework/core/annotation/AnnotationUtils.findAnnotationDeclaringClass(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Class;
at org.springframework.test.context.TestContext.retrieveContextLocations(TestContext.java:143)
at org.springframework.test.context.TestContext.<init>(TestContext.java:108)
at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:103)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTestContextManager(SpringJUnit4ClassRunner.java:102)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:79)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:521)
at org.junit.internal.requests.ClassRequest.buildRunner(ClassRequest.java:33)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:28)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:26)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:34)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:24)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Analization of the problem:

We import wrong version of the spring-support-2.0.8.jar in dependent projects, the right version we should import is 2.5.5  . If you meet with the problem like this when using spring's testing framework to test, you can imagine that it maybe caused by the wrong version of jar relative to spring.

The approach to this problem:

1. Find the classpath file of your project;
2. Open it with a  editing tool of text;
3. Fine the spot where the jars relating to spring are;
4. Select those jars , cut and paste them to the top position of this file.(To make sure that the IDE can find the right version of jars).



分享到:
评论

相关推荐

    spring-framework-reference-4.1.2

    Not Using Commons Logging ................................................................... 12 Using SLF4J ..............................................................................................

    spring-framework-reference4.1.4

    Not Using Commons Logging ................................................................... 12 Using SLF4J ..............................................................................................

    Dealing with stress.doc

    "Dealing With Stress" 这个主题的工作坊就是为此而设,旨在帮助参与者理解和管理他们面临的压力。 首先,我们要理解压力的来源。在大学生活中,学生面临的主要压力源包括: 1. **学术压力**:大学课程繁重,报告...

    building restful web services with spring 5 2e

    Find out how to implement the REST architecture to build resilient software in Java with the help of the Spring 5.0 framework. REST is an architectural style that tackles the challenges of building ...

    071431_VB_picture_dealing_with.rar_vb matlab

    标题中的"071431_VB_picture_dealing_with.rar_vb matlab"指的是一个关于VB(Visual Basic)和MATLAB结合使用的图像处理压缩包。这个压缩包可能包含了一系列的VB代码和MATLAB脚本,用于图像的导入、处理和分析。 在...

    esales_v1.0_account.dealing.data.rp

    esales_v1.0_account.dealing.data.rp

    [android.开发书籍].Beginning.Android.2.(Apress,.2010,.1430226293).pdf

    ■Chapter 10: The Input Method Framework ............................................................................................ 117 ■Chapter 11: Applying Menus.....................................

    八年级英语Dealing with troublePPT课件.pptx

    这篇PPT课件是针对八年级英语教学的内容,主题为“应对困难”(Dealing with trouble)。通过一系列的填空练习和情景模拟,旨在帮助学生掌握如何在不同情况下正确处理问题,尤其是面对紧急情况时的应对策略。以下是...

    java.核心技术.第八版 卷1

    When it first came out in 1996 it had no competitors, and now alternatives abound, in particular the "Head First" series for learning Java published by O'Reilly and Associates. However, this is still...

    Better,Faster,Lighter Java mobi格式

    ManyEnterprise Java developers, accustomed to dealing with Java'sspiraling complexity, have fallen into the habit of choosing overlycomplicated solutions to...problems when simpler options are...

    Addison.Wesley.The.Java.Programming.Language.4th.Edition.Aug.2005.chm

    giving overviews of those packages not covered in more detail in this book. &lt;br&gt;Appendix AApplication Evolutionlooks at some of the issues involved in dealing with the evolution of applications and...

    C# Game Programming Cookbook for Unity 3D - 2014

    3.4 User Data Manager (Dealing with Player Stats Such as Health, Lives, etc.)....37 3.4.1 Script Breakdown..........................................39 4. Recipes: Common Components 41 4.1 Introduction...

    ASP.NET MVC with Entity Framework and CSS

    ASP.NET MVC with Entity Framework and CSS by Lee Naylor 2016 | ISBN: 1484221362 | English | 608 pages | True PDF | 30 MB This book will teach readers how to build and deploy a fully working example ...

    Springer.The.Developer’s.Guide.to.Debugging.2008.pdf

    9 Dealing with Linking Problems . . . . . . . . . . 109 9.1 How a Linker Works . . . . . . . . . . 109 9.2 Building and Linking Objects . . . . . . . . 110 9.3 Resolving Undefined Symbols . . . . . . ...

    MySQL 5.6 Reference Manual

    Table of Contents Preface, Notes, Licenses . . . . . . . . ....1. Licenses for Third-Party Components ....1.1. FindGTest.cmake License ....1.2. LPeg Library License ....1.3. LuaFileSystem Library License ....

    Zend Framework 2 Application Development

    Exploring real life applications, we will explore the Zend Framework 2 components, as well as throwing some light on best practices and design concerns faced when building complex MVC applications. ...

    jdk1.8.docx

    7. **Parallel Collectors**: The Collections Framework was enhanced with parallel processing capabilities, enabling faster execution of collection operations using multiple threads. These collectors ...

Global site tag (gtag.js) - Google Analytics