java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

SpringSource Issue Tracker | Keith Donald | 5 years ago
  1. 0

    Project: Spring Social, a multi-module build Module effected: spring-social-web Test that fails with ClassNotFoundException: org.springframework.social.connect.web.ConnectSupportTest Class in error: Says "javax.servlet.http.HttpServletRequest" - despite the fact servlet-api-2.5.jar is a "Gradle Dependency" and the class is there. Somewhat unrelated, for some reason STS (2.7) is also not allowing me to run this class "as a unit test". I'm having to run it by selecting the src/test/java folder and running that folder. {code} java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest 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.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) at java.lang.Class.getMethod0(Class.java:2670) at java.lang.Class.getMethod(Class.java:1603) at org.junit.internal.builders.SuiteMethodBuilder.hasSuiteMethod(SuiteMethodBuilder.java:20) at org.junit.internal.builders.SuiteMethodBuilder.runnerForClass(SuiteMethodBuilder.java:13) 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.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38) 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.ClassNotFoundException: javax.servlet.http.HttpServletRequest 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) ... 30 more {code}

    SpringSource Issue Tracker | 5 years ago | Keith Donald
    java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
  2. 0

    Project: Spring Social, a multi-module build Module effected: spring-social-web Test that fails with ClassNotFoundException: org.springframework.social.connect.web.ConnectSupportTest Class in error: Says "javax.servlet.http.HttpServletRequest" - despite the fact servlet-api-2.5.jar is a "Gradle Dependency" and the class is there. Somewhat unrelated, for some reason STS (2.7) is also not allowing me to run this class "as a unit test". I'm having to run it by selecting the src/test/java folder and running that folder. {code} java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest 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.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) at java.lang.Class.getMethod0(Class.java:2670) at java.lang.Class.getMethod(Class.java:1603) at org.junit.internal.builders.SuiteMethodBuilder.hasSuiteMethod(SuiteMethodBuilder.java:20) at org.junit.internal.builders.SuiteMethodBuilder.runnerForClass(SuiteMethodBuilder.java:13) 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.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38) 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.ClassNotFoundException: javax.servlet.http.HttpServletRequest 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) ... 30 more {code}

    SpringSource Issue Tracker | 5 years ago | Keith Donald
    java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
  3. 0

    java.lang.NoClassDefFoundError: How to resolve – Part 2 ~ Java EE Support Patterns

    blogspot.com | 1 month ago
    java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java.lang.NoClassDefFoundError: org/openqa/selenium/Capabilities error

    GitHub | 2 years ago | Selen1
    java.lang.NoClassDefFoundError: org/openqa/selenium/Capabilities
  6. 0

    NoClassDefFoundError: [LThing;

    Stack Overflow | 2 years ago
    java.lang.NoClassDefFoundError: [LThing;

  1. davidvanlaatum 14 times, last 6 months ago
  2. Luka 4 times, last 2 months ago
29 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.ClassNotFoundException

    javax.servlet.http.HttpServletRequest

    at java.net.URLClassLoader$1.run()
  2. Java RT
    Class.getMethod
    1. java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    2. java.security.AccessController.doPrivileged(Native Method)
    3. java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    4. java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    5. sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    6. java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    7. java.lang.ClassLoader.defineClass1(Native Method)
    8. java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    9. java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    10. java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    11. java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    12. java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    13. java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    14. java.security.AccessController.doPrivileged(Native Method)
    15. java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    16. java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    17. sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    18. java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    19. java.lang.Class.getDeclaredMethods0(Native Method)
    20. java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
    21. java.lang.Class.getMethod0(Class.java:2670)
    22. java.lang.Class.getMethod(Class.java:1603)
    22 frames
  3. JUnit
    ClassRequest.getRunner
    1. org.junit.internal.builders.SuiteMethodBuilder.hasSuiteMethod(SuiteMethodBuilder.java:20)
    2. org.junit.internal.builders.SuiteMethodBuilder.runnerForClass(SuiteMethodBuilder.java:13)
    3. org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    4. org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
    5. org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    6. org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
    6 frames
  4. JUnit4 Runner
    JUnit4TestLoader.loadTests
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
    2. org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
    3. org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
    4. org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
    4 frames
  5. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    4 frames