Announcement Announcement Module
Collapse
No announcement yet.
mvc new resources tag error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • mvc new resources tag error

    With SST 2.3.2 I created a Spring MVC template project and set the
    <resources mapping="/resources/**" location="/resources/" /> tag that it`s used in the showcase example project and that I can run with out any problem.
    But in this new project I get the following :

    ERROR: org.springframework.web.servlet.DispatcherServlet - Context initialization failed
    org.springframework.beans.factory.xml.XmlBeanDefin itionStoreException: Line 18 in XML document from ServletContext resource [/WEB-INF/spring/mvc-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'resources'. One of '{"http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, WC[##other:"http://www.springframework.org/schema/beans"]}' is expected.

    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'resources'. One of '{"http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, WC[##other:"http://www.springframework.org/schema/beans"]}' is expected.


    could anyone help me please. I tried copying all dependencies and properties from the showcase project and still nothing ...
    thanks

  • #2
    I think you want to use the mvc namespace:

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

    Comment


    • #3
      mvc:resources ,I get the following error

      I created a Spring MVC template project and set the
      <mvc:resources mapping="/resources/**" location="/resources/" /> tag and I can run the spring mvc project. But in this new project I get the following :

      Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:resources'.
      at com.sun.org.apache.xerces.internal.util.ErrorHandl erWrapper.createSAXParseException(ErrorHandlerWrap per.java:195)
      at com.sun.org.apache.xerces.internal.util.ErrorHandl erWrapper.error(ErrorHandlerWrapper.java:131)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorRe porter.reportError(XMLErrorReporter.java:384)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorRe porter.reportError(XMLErrorReporter.java:318)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSche maValidator$XSIErrorReporter.reportError(XMLSchema Validator.java:417)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSche maValidator.reportSchemaError(XMLSchemaValidator.j ava:3181)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSche maValidator.handleStartElement(XMLSchemaValidator. java:1926)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSche maValidator.emptyElement(XMLSchemaValidator.java:7 25)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocum entScannerImpl.scanStartElement(XMLNSDocumentScann erImpl.java:377)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl$FragmentContentDriver.next(XM LDocumentFragmentScannerImpl.java:2755)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumen tScannerImpl.next(XMLDocumentScannerImpl.java:648)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocum entScannerImpl.next(XMLNSDocumentScannerImpl.java: 140)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl.scanDocument(XMLDocumentFragm entScannerImpl.java:511)
      at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(XML11Configuration.java:808)
      at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(XML11Configuration.java:737)
      at com.sun.org.apache.xerces.internal.parsers.XMLPars er.parse(XMLParser.java:119)
      at com.sun.org.apache.xerces.internal.parsers.DOMPars er.parse(DOMParser.java:235)
      at com.sun.org.apache.xerces.internal.jaxp.DocumentBu ilderImpl.parse(DocumentBuilderImpl.java:284)
      at org.springframework.beans.factory.xml.DefaultDocum entLoader.loadDocument(DefaultDocumentLoader.java: 75)
      at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:388)
      ... 30 more

      Please help me , Thanks!

      Comment


      • #4
        Most likely your Spring configuration file is missing the mvc namespace declaration. This is used by your IDE to validate the XML. The top of your Spring configuration should include spring-mvc-3.0.xml like the following (note the bold areas):

        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:mvc="http://www.springframework.org/schema/mvc"
        	xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
        	xmlns:oxm="http://www.springframework.org/schema/oxm"
        	xsi:schemaLocation="http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd
        		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
        		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
        		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
        Last edited by jamestastic; Sep 19th, 2010, 11:25 AM.

        Comment


        • #5
          I resolved this problem. thank you very much! jamestastic

          Comment


          • #6
            Originally posted by kensunhu View Post
            I resolved this problem. thank you very much! jamestastic
            Hi Kensunhu,

            I encountered the same problem. I went through docs but still failed to figure it out.

            Could you post your get around?

            Thank you.

            Comment

            Working...
            X