无法找到元素 [资源] 的 BeanDefinitionParser [英] Cannot locate BeanDefinitionParser for element [resources]

查看:29
本文介绍了无法找到元素 [资源] 的 BeanDefinitionParser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将我的 Web 应用程序迁移到 Spring 3.2.3.最近在尝试解决静态页面问题时,我遇到了 mvc:resources 命名空间.但是,我在 application context.xml 文件中收到错误消息.我已经搜索了很多但无法解决问题.请帮助.我使用的是我的 Eclipse 8.6 和 Tomcat 6.

I have recently migrated my web app to Spring 3.2.3. recently when trying to resolve static pages issue I came across mvc:resources namespace. But,I am getting the error in application context.xml file. I have searched a lot but could not solve the issue.Please help. I am using My Eclipse 8.6 and Tomcat 6.

请注意 control+space 建议 mvc:resources.but 一旦我使用,它就会抛出无法找到元素 [resources] 的 BeanDefinitionParser

Please note that control+space suggests mvc:resources.but as soon as i use, it throws Cannot locate BeanDefinitionParser for element [resources]

还尝试使用具有显式版本的架构.我已经粘贴了相关代码

Tried to use schema with an explicit version also. I have pasted relevant code

 <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:p="http://www.springframework.org/schema/p"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:mvc="http://www.springframework.org/schema/mvc" 
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx"

        xsi:schemaLocation="
                http://www.springframework.org/schema/beans 
                http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                http://www.springframework.org/schema/context 
                http://www.springframework.org/schema/context/spring-context-3.2.xsd
                http://www.springframework.org/schema/mvc
                http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
                http://www.springframework.org/schema/aop 
                http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
                http://www.springframework.org/schema/tx 
                http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">

    <mvc:resources location="" mapping=""/>

</beans>

推荐答案

确保您必须更正类路径上的 jar,确保 spring-webmvc.jar 位于类路径上.使用 Maven(或 Gradle)时,请确保您的类路径中有该 jar 的单一(且正确)版本.多个版本可能会发生冲突.

Make sure that you have to correct jars on your classpath, make sure that spring-webmvc.jar is on the classpath. When using Maven (or Gradle) make sure that you have a single (and correct) version of that jar on your classpath. Multiple versions can conflict.

这篇关于无法找到元素 [资源] 的 BeanDefinitionParser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆