juni单元测试

Caused by: java.lang.NoClassDefFoundError: org/junit/runners/BlockJUnit4ClassRunner
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:95)
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:107)
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31)
    at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:370)
    at sun.reflect.annotation.AnnotationParser.parseClassValue(AnnotationParser.java:351)
    at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:280)
    at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:222)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
    at java.lang.Class.initAnnotationsIfNecessary(Class.java:3070)
    at java.lang.Class.initAnnotationsIfNecessary(Class.java:3077)
    at java.lang.Class.initAnnotationsIfNecessary(Class.java:3077)
    at java.lang.Class.initAnnotationsIfNecessary(Class.java:3077)
    at java.lang.Class.getAnnotation(Class.java:3029)
    at org.junit.internal.requests.ClassRequest.getRunnerClass(ClassRequest.java:45)
    ... 9 more
Caused by: java.lang.ClassNotFoundException: org.junit.runners.BlockJUnit4ClassRunner
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 38 more

 错误原因是 junit包和spring包不兼容
    junit 4.4 spring 3.1.2-RELEASE版本

你可能感兴趣的:(单元测试)