1、启动项目报如下所示错误:
1 java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet 2 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1335) 3 at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1163) 4 at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:542) 5 at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:523) 6 at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:150) 7 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091) 8 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1027) 9 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5037) 10 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5347) 11 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) 12 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) 13 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) 14 at java.util.concurrent.FutureTask.run(FutureTask.java:266) 15 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 16 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 17 at java.lang.Thread.run(Thread.java:748)
如下图所示错误:
解决方法如下所示:
自己的项目上右键properties,Deployment Assembly -> Add -> Java Build Path Entries -> Next -> Maven Dependencies -> Finish -> Apply -> Apply and Close,配置完后如下图:
再次启动你的项目就可以了。