Cannot locate BeanDefinitionParser for element [resources]

元气小坏坏 提交于 2019-12-11 20:49:28

问题


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.

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>

回答1:


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.



来源:https://stackoverflow.com/questions/18434380/cannot-locate-beandefinitionparser-for-element-resources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!