【问题标题】:Class 'org.springframework.web.servlet.view.InternalResourceViewResolver' not found error类 'org.springframework.web.servlet.view.InternalResourceViewResolver' 未找到错误
【发布时间】:2012-03-02 09:48:17
【问题描述】:

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

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

有人知道如何解决这个问题吗?

【问题讨论】:

    标签: eclipse spring sts-springsourcetoolsuite


    【解决方案1】:

    我在我的 Maven 配置中遇到了这个问题。正如 Ivan 在他的回答中提到的那样,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依赖。

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

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

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

    【讨论】:

    • 如果您遇到此问题并且您已经添加了spring-webmvc,只需将其删除并重新添加即可。这解决了我的问题。
    【解决方案2】:

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

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

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

    【讨论】:

    • 这对我也有用。为什么没有答案标记为正确?
    【解决方案3】:

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

    F5,清理项目,F5,服务器清理,也许是服务器清理工作目录。

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

    【讨论】:

    • 这对我有用,但只有在我记得安装 m2e Maven 插件之后。 eclipse.org/m2e
    【解决方案4】:

    只需清理项目并在您的 POM.xml 文件中检查此依赖项 肯定会正常工作的。

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

    【讨论】:

      【解决方案5】:

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

      【讨论】:

        【解决方案6】:

        我必须在 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>
        

        【讨论】:

          猜你喜欢
          • 2014-01-31
          • 2014-01-24
          • 2013-09-04
          • 2019-04-29
          • 2018-05-19
          • 2018-05-27
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多