java Spring Dispatcher Servlet Not Found问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/3059817/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Spring Dispatcher Servlet Not Found Problem
提问by aykut
I'm trying to build a simple spring web application but I get the following error when I run it on Apache Tomcat 6.0
我正在尝试构建一个简单的 spring web 应用程序,但是当我在 Apache Tomcat 6.0 上运行它时出现以下错误
Class Not Found Exception org.springframework.web.servlet.DispatcherServlet
I'm using maven to handle libraries. At first I thought it was maven's fault but it adds spring and other libraries succesfully.
我正在使用 maven 来处理库。起初我认为这是 maven 的错,但它成功地添加了 spring 和其他库。
I tried to import "org.springframework.web.servlet.DispatcherServlet" in a source file and my project has the right package and classes.
我试图在源文件中导入“org.springframework.web.servlet.DispatcherServlet”,我的项目有正确的包和类。
My development environment :
我的开发环境:
Ubuntu 10.4 Eclipse IDE Tomcat 6.0
Ubuntu 10.4 Eclipse IDE Tomcat 6.0
I'd appreciate any help
我很感激任何帮助
回答by Satesh
Make sure that your pom.xml is having compile time dependency like bellow
确保您的 pom.xml 具有如下所示的编译时依赖项
<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>2.5.6</version>
            <scope>compile</scope>
</dependency>
Once project is build unzip your war file see it has required dependencies packaged properly or not in WEB-INF/lib
构建项目后,解压缩您的War文件,看看它是否在 WEB-INF/lib 中正确打包了所需的依赖项
回答by Zeba
I added external jars thru java build path which were not reflected in web-inf/lib folder.so,the error occured.
我通过 java 构建路径添加了外部 jars,这些路径没有反映在 web-inf/lib 文件夹中。所以,发生了错误。
I copied all those jars and pasted in the web-inf/lib folder and then my prob got solved.
我复制了所有这些 jars 并粘贴到 web-inf/lib 文件夹中,然后我的问题得到了解决。
Hope it helps.
希望能帮助到你。
回答by amit
works well when I copied all springwebmvc jars and pasted in WEB-INF/lib folder.....
当我复制所有 springwebmvc jar 并粘贴到 WEB-INF/lib 文件夹中时,效果很好.....
回答by Jomon George
回答by prashant
Right click on project -> Properties -> Deployment Assembly -> Add ->Java Build path entries -> maven dependency -> Finesh.
右键单击项目-> 属性-> 部署程序集-> 添加-> Java 构建路径条目-> maven 依赖项-> Finesh。
回答by duffymo
If you can't find that class in WEB-INF/lib, the classloader won't either. Believe the JVM and assume that you (or Maven) has packaged or deployed it incorrectly.
如果您在 WEB-INF/lib 中找不到那个类,类加载器也不会。相信 JVM 并假设您(或 Maven)错误地打包或部署了它。
回答by nokheat
You may need to copy the contents of dist/ of the spring downloads and the required linked packages to web-inf/lib then try start server again
您可能需要将 spring 下载的 dist/ 内容和所需的链接包复制到 web-inf/lib,然后再次尝试启动服务器


