Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-9450

BlockJUnit4ClassRunner not found when using the TestContext framework from Eclipse user library

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Test
    • Last commented by a User:
      false

      Description

      In my test project I use the Spring TestContext Framework and JUnit 4.

      When I refer to my jars as an Eclipse user library, the following exception is thrown when I launch a test configured with @RunWith(SpringJUnit4ClassRunner.class).

      java.lang.TypeNotPresentException: Type [unknown] not present
      	at sun.reflect.annotation.TypeNotPresentExceptionProxy.generateException(TypeNotPresentExceptionProxy.java:27)
      	at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:56)
      	at $Proxy4.value(Unknown Source)
      	at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
      	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
      	at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
      	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
      	at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
      	at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:33)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:32)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestMethodReference.<init>(JUnit4TestMethodReference.java:25)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:42)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:31)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      Caused by: java.lang.NoClassDefFoundError: org/junit/runners/BlockJUnit4ClassRunner
      	at java.lang.ClassLoader.findBootstrapClass(Native Method)
      	at java.lang.ClassLoader.findBootstrapClass0(ClassLoader.java:892)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:302)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:300)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
      	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
      	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:3072)
      	at java.lang.Class.getAnnotation(Class.java:3029)
      	at org.junit.internal.builders.IgnoredBuilder.runnerForClass(IgnoredBuilder.java:13)
      	... 13 more
      

        Attachments

          Activity

            People

            • Assignee:
              sbrannen Sam Brannen
              Reporter:
              sslhj leehom
              Last updater:
              Sam Brannen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 45 weeks, 1 day ago