spring 找不到类“org.springframework.web.servlet.view.InternalResourceViewResolver”错误

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

Class 'org.springframework.web.servlet.view.InternalResourceViewResolver' not found error

eclipsespringsts-springsourcetoolsuite

提问by quarks

I'm getting this error with my Spring MVC sample application using Spring STS Eclipse plugin:

我在使用 Spring STS Eclipse 插件的 Spring MVC 示例应用程序中遇到此错误:

Class 'org.springframework.web.servlet.view.InternalResourceViewResolver' not found [config set: webninar-hello/web-context]servlet-context.xml

找不到类“org.springframework.web.servlet.view.InternalResourceViewResolver”[配置集:webninar-hello/web-context]servlet-context.xml

Anyone have an idea how to fix this?

任何人都知道如何解决这个问题?

回答by uiroshan

I had this problem with a mistake in my maven configuration. As Ivan mentioned in his answer org.springframework.web.servlet-3.1.2.RELEASE.jarwas not at my lib directory. So I searched for it's maven dependency from http://blog.springsource.org/2009/12/02/obtaining-spring-3-artifacts-with-maven/URL.

我在我的 Maven 配置中遇到了这个问题。正如伊万在他的回答org.springframework.web.servlet-3.1.2.RELEASE.jar中提到的,不在我的 lib 目录中。所以我从http://blog.springsource.org/2009/12/02/obtaining-spring-3-artifacts-with-maven/URL搜索它的 maven 依赖。

Then I realized I included wrong dependency in my pom.xml correct dependency as follows

然后我意识到我在 pom.xml 正确的依赖中包含了错误的依赖如下

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

Previously I had spring-webas the artifactId. Hope this helps :)

以前我有spring-web作为artifactId。希望这可以帮助 :)

回答by Ivan Alagenchev

I had the same problem and it wasn't a refreshing problem for me. I had to add the following jar to my build path:

我遇到了同样的问题,这对我来说并不是一个令人耳目一新的问题。我必须将以下 jar 添加到我的构建路径中:

org.springframework.web.servlet-3.1.2.RELEASE.jar

You can download the Spring bundle from the Spring website: http://www.springsource.org/spring-community-download

您可以从 Spring 网站下载 Spring 包:http: //www.springsource.org/spring-community-download

回答by Ralph

Sounds like a refreshing problem.

听起来像是一个令人耳目一新的问题。

F5, Cleanup Project, F5, Server Clean, maybe Server Clean Working directory.

F5,清理项目,F5,服务器清理,可能是服务器清理工作目录。

If this all does not help. Remove the application from the server (close the window) and then add it again.

如果这一切都没有帮助。从服务器中删除应用程序(关闭窗口),然后再次添加它。

回答by Buddheshwar Ojhar

Just clean the project and check this dependency in your POM.xml file Definitely it will work fine.

只需清理项目并在您的 POM.xml 文件中检查此依赖项绝对可以正常工作。

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

回答by Andres Gonzalez

I deleted everything under /Users//.m2/repository with rm -R * and then rebuilt everything with Maven>>Update Project, closed and reopened project, cleaned project and then it worked.

我用 rm -R * 删除了 /Users//.m2/repository 下的所有内容,然后使用 Maven>>Update Project 重建了所有内容,关闭并重新打开了项目,清理了项目,然后它工作了。

回答by Lali

I had to add following dependencies to pom filefor resolve this issue.

我不得不将以下依赖项添加到 pom 文件以解决此问题。

    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
        <scope>compile</scope>
    </dependency>