spring 找不到类:org.springframework.web.servlet.DispatcherServlet

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19288796/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 06:17:08  来源:igfitidea点击:

Class Not found : org.springframework.web.servlet.DispatcherServlet

eclipsespringhibernatespring-mvc

提问by Babanna Duggani

In spring-hibernate project, I have added all jars required in some User created library in eclipse. But still it is giving the exception that, ServletDispatcher is not available. Below all jar files included are shown, just help me which one I left.

在 spring-hibernate 项目中,我在 eclipse 中添加了一些用户创建的库中所需的所有 jars。但它仍然给出了一个例外,即 ServletDispatcher 不可用。下面显示了包含的所有 jar 文件,请帮我看看我留下了哪一个。

org.springframework.aop-3.0.4.RELEASE.jar
org.springframework.asm-3.0.4.RELEASE.jar
org.springframework.aspects-3.0.4.RELEASE.jar
org.springframework.beans-3.0.4.RELEASE.jar
org.springframework.context.support-3.0.4.RELEASE.jar
org.springframework.context-3.0.4.RELEASE.jar
org.springframework.core-3.0.4.RELEASE.jar
org.springframework.expression-3.0.4.RELEASE.jar
org.springframework.instrument.tomcat-3.0.4.RELEASE.jar
org.springframework.instrument-3.0.4.RELEASE.jar
org.springframework.jdbc-3.0.4.RELEASE.jar
org.springframework.jms-3.0.4.RELEASE.jar
org.springframework.orm-3.0.4.RELEASE.jar
org.springframework.oxm-3.0.4.RELEASE.jar
org.springframework.test-3.0.4.RELEASE.jar
org.springframework.transaction-3.0.4.RELEASE.jar
org.springframework.web.portlet-3.0.4.RELEASE.jar
org.springframework.web.servlet-3.0.4.RELEASE.jar
org.springframework.web.struts-3.0.4.RELEASE.jar
org.springframework.web-3.0.4.RELEASE.jar
hibernate3.jar
jstl.jar
standard.jar
org.springframework.webflow-2.2.1.RELEASE.jar

StackTrace is:

堆栈跟踪是:

SEVERE: Servlet /PersonLoanManegment threw load() exception
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)              
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:525)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:507)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:124)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1136)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5015)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5302)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

回答by Sarothia

I found adding to the POM:

我发现添加到 POM:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-webmvc</artifactId>
  <version>${spring-framework.version}</version>
</dependency>

Added the needing file and IntelliJ was able to resolve the DispatcherServlet.

添加了需要的文件,IntelliJ 能够解析 DispatcherServlet。

回答by esmoreno

You need jar spring-web-3.0.4.RELEASE.jar in your classpath. With Maven:

您的类路径中需要 jar spring-web-3.0.4.RELEASE.jar。使用 Maven:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>3.0.4.RELEASE</version>
</dependency>

Regards

问候

回答by Laurence Geng

Maybe, it's not because you lost dependency configuration. you should check whether the jar is really available, follow this:

也许,这不是因为您丢失了依赖项配置。您应该检查jar是否真的可用,请按照以下步骤操作:

package your project, then unzip it, check: /WEB-INF/lib, see if the org.springframework.web.servlet-3.0.4.RELEASE.jar exists! if yes, unzip this jar, see if it's corrupt! it it's not existing or corrupt, check your maven repository, you can remove this artifact from your maven repository, and rebuild, let maven re-download it. Good luck!

打包你的项目,然后解压,检查:/WEB-INF/lib,查看org.springframework.web.servlet-3.0.4.RELEASE.jar是否存在!如果是,请解压这个 jar,看看它是否已损坏!如果它不存在或损坏,请检查您的 Maven 存储库,您可以从 Maven 存储库中删除此工件,然后重建,让 Maven 重新下载它。祝你好运!

回答by shazin

You need jar org.springframework.web.servlet-3.0.4.RELEASE.jarin your classpath. Which contains org.springframework.web.servlet.DispatcherServlet

org.springframework.web.servlet-3.0.4.RELEASE.jar的类路径中需要 jar 。其中包含org.springframework.web.servlet.DispatcherServlet

回答by Pratik Shelar

Whenever you come across ClassNotFound exceptions try to find the missing jar using the various online tools like jarFinder

每当您遇到 ClassNotFound 异常时,请尝试使用jarFinder等各种在线工具查找丢失的 jar