Adding css files in spring mvc -


i want add css files in spring mvc project.i using myeclipse.

i adding <mvc:resources mapping="/resources/**" location="/web-inf/resources/" /> in spring-servlet.xml

when going run getting exception

exception

javax.servlet.servletexception: servlet.init() servlet spring threw exception org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:104) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:261) org.apache.coyote.http11.http11processor.process(http11processor.java:844) org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:581) org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:447) java.lang.thread.run(thread.java:619) root cause

org.springframework.beans.factory.parsing.beandefinitionparsingexception: configuration problem: cannot locate beandefinitionparser element [resources] offending resource: servletcontext resource [/web-inf/spring-servlet.xml] org.springframework.beans.factory.parsing.failfastproblemreporter.fatal(failfastproblemreporter.java:59) org.springframework.beans.factory.parsing.readercontext.fatal(readercontext.java:68) org.springframework.beans.factory.parsing.readercontext.fatal(readercontext.java:55) org.springframework.beans.factory.xml.namespacehandlersupport.findparserforelement(namespacehandlersupport.java:84) org.springframework.beans.factory.xml.namespacehandlersupport.parse(namespacehandlersupport.java:73) org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1335) org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1325) org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.parsebeandefinitions(defaultbeandefinitiondocumentreader.java:136) org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.registerbeandefinitions(defaultbeandefinitiondocumentreader.java:93) org.springframework.beans.factory.xml.xmlbeandefinitionreader.registerbeandefinitions(xmlbeandefinitionreader.java:493) org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:390) org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:334) org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:302) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:143) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:178) org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:149) org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:124) org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:93) org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:130) org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:465) org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:395) org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:443) org.springframework.web.servlet.frameworkservlet.createwebapplicationcontext(frameworkservlet.java:459) org.springframework.web.servlet.frameworkservlet.initwebapplicationcontext(frameworkservlet.java:340) org.springframework.web.servlet.frameworkservlet.initservletbean(frameworkservlet.java:307) org.springframework.web.servlet.httpservletbean.init(httpservletbean.java:127) javax.servlet.genericservlet.init(genericservlet.java:212) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:104) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:261) org.apache.coyote.http11.http11processor.process(http11processor.java:844) org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:581) org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:447) java.lang.thread.run(thread.java:619)

my spring-servlet.xml is

<?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"  xsi:schemalocation="http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  http://www.springframework.org/schema/mvc   http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd  http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd">  <mvc:resources mapping="/resources/**" location="/web-inf/resources/" />   <context:component-scan  base-package="com.arobol.controller" />    <bean class="org.springframework.web.servlet.view.internalresourceviewresolver">      <property name="prefix" value="/web-inf/jsp/" />        <property name="suffix" value=".jsp" />     </bean> </beans> 

make sure xml schema of xml file corresponding spring version, spring 3.0 should like

<?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:context="http://www.springframework.org/schema/context"      xmlns:mvc="http://www.springframework.org/schema/mvc"      xsi:schemalocation="       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd       http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> 

the stacktrace issue saying

configuration problem: cannot locate beandefinitionparser element [resources] offending resource: servletcontext resource [/web-inf/spring-servlet.xml]  

appears though you're having mistmatch between jars , included schema

update

better yet, include xsds without version, match schema's schemas you're using in app. like

<?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:context="http://www.springframework.org/schema/context"      xmlns:mvc="http://www.springframework.org/schema/mvc"      xsi:schemalocation="       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd       http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -