
How to fix HTTP Status 404 Error while running Spring MVC project?
I have been running Spring MVC projects since last ~8 years and created numerous professional and personal project in Java and Spring MVC combination.
On Crunchify we have more than ~50 Spring MVC tutorial for you to use for free. Today while running my old Hello World Spring MVC tutorial I got below error message while starting Tomcat in Eclipse IDE.
Jul 20, 2016 2:12:20 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet [crunchify] in web application [/CrunchifySpringMVCTutorial] threw load() exception java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1142) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:518) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:499) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1102) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4997) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5289) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
Why this exception happened:
Most probably the necessary Spring MVC related jar files are not loaded and deployed on tomcat startup. But note: these files are in your classpath and hence you are not getting any error in Eclipse IDE during development time. Happens only during runtime.
How to fix this?
Step-1
- Right click on project
- Click on
Properties
Step-2
- Click on
Deployment AssemblyTab in the left - Click
Add...

Step-3
Click on Java Build Path Entries

Step-4
- Click on
Maven Dependencies - Click
Finishbutton

Step-5
- Redeploy Spring MVC application to Tomcat again
- Restart Tomcat
- Try accessing URL again and you shouldn’t see any error now

Sao tui add thư viện maven rồi nhưng lỗi vẫn xảy ra ?
I have done the same that you mentioned but still gettig the same error –
Apr 11, 2023 3:29:50 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [LKGDP4CWSvc] in web application [/dp4cwlicsvc] threw load() exception
java.lang.ClassNotFoundException: org.springframework.beans.factory.Aware
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1412)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220)
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
Thank You very much ,your solution worked fine for me …
Thank you.
Many Thanks
Welcome Mr. Eddy.
thanks guys, really helpful page.
You are welcome Praveen. Appreciate your comment.
Great advice, it saved me alot of frustration on a tutorial project I was working on.
I’m glad tutorial helped you Michael. Happy coding.
Thanks a lot man, was struggling for a long time
You are welcome Yogesh. Happy coding and keep visiting.
you saved my time
Aaha!! Glad to hear that 🙂
You help me a lot, I spent a week just for fixing this bug. Thanks sir!
You are welcome Huy. I’m glad it worked well for you. Happy coding and keep visiting.
sir it is showing empty how to solve it i can’t understand
Yes. It works for me.Thanks for the post.
You are welcome Rajendra. Happy coding.
You are welcome Ramakoteswararao Gutta. Appreciate your comment.
i have tried the above steps but i still got the same issue
Hi Ravip – did you try cleaning your worksspace and building your project again? Try following this tutorial: https://crunchify.com/mavenmvn-clean-install-update-project-and-project-clean-options-in-eclipse-ide-to-fix-any-dependency-issue/
After i tried this way, got this exception.
Please help my issue. Thank u in advance.
Hi Sarjita – are you using Java9? You may face this issue with Java SE9. Also, try adding below dependencies to your project in pom.xml file.
javax.xml.bind jaxb-api 2.2.11 com.sun.xml.bind jaxb-core 2.2.11 com.sun.xml.bind jaxb-impl 2.2.11Let me know your result when you get a chance.
Really nice article.
Could you, please, help me in case of Gradle use? When I see the window “Java Build Path References”, it’s totally empty and there is nothing to apply.
How to proceed?
Hi Julia –
Can you please share your screenshot? I would like to debug it further.
Hello! Thanks for your tutorial and this post.
I implemented it and fixed my initial error with ClassNotFound,
but in the console there is still this warning:
Sep 23, 2017 8:17:14 PM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/CrunchifySpringMVCTutorial/] in DispatcherServlet with name ‘crunchify’
and my application keeps throwing 404 🙁
Could you help me?
Hi Sabrina Perardt –
Error shows you have some conflict with servlet-name and servlet-class. Make sure to take a look at Spring MVC tutorial.
I tried all things but I can not succeed.
Hi Harsh – it’s complaining about nDMS. What is it?
Thanks
You are most welcome Krishna.
Thank you soo much!!!!!!
You are welcome Mansi. Happy coding.
When I click on Java Build Path Entries and click Next, it does not show Maven dependencies. It just shows a empty box where there is nothing to select. How can I fix this?
Thanks.
Hi Kumar – is your project a Maven Project? If yes, you could see maven dependency. If not, you could convert it by following this tutorial: https://crunchify.com/how-to-convert-existing-java-project-to-maven-in-eclipse/
Also, would be nice if you share your Eclipse project structure screenshot.
Hope that helps.
Yes my project is Maven Project but I cannot see the Maven dependencies. My project structure is as follows. Screenshot.
Thanks for sharing screenshot Kumar. Dependencies should be under /target folder.
try following this tutorial and errors should go away: https://crunchify.com/mavenmvn-clean-install-update-project-and-project-clean-options-in-eclipse-ide-to-fix-any-dependency-issue/
thanks