Results 1 to 4 of 4

Thread: Failed to read 'http://www.springframework.org/schema/context/spring--context-3.0.xsd

  1. #1
    Join Date
    Jun 2010
    Posts
    119

    Default Failed to read 'http://www.springframework.org/schema/context/spring--context-3.0.xsd

    Hello,
    I have create this simple "Hello World" project: http://viralpatel.net/blogs/spring-3...-spring-3-mvc/ using Spring 3.1.2 and STS 3.1.0 as IDE

    The project run well and I can see first the welcome page that show the link "Say Hello", and if here I click on this link open the page with the Hello message: "Hello World, Spring 3.0!"

    But I have 2 strange errors reported in Eclipse in my spring-servlet.xml configuration file:

    This is my spring-servlet.xml file content:
    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"
       
        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">
     
        <context:component-scan base-package="net.viralpatel.spring3.controller" />
             
        <bean id="viewResolver"
            class="org.springframework.web.servlet.view.UrlBasedViewResolver">
            <property name="viewClass"
                value="org.springframework.web.servlet.view.JstlView" />
            <property name="prefix" value="/WEB-INF/jsp/" />
            <property name="suffix" value=".jsp" />
        </bean>
    </beans>
    The first reported errors is at line 11:

    Code:
            http://www.springframework.org/schema/context/spring-context.xsd">
    This error is reported by the red circle icon whith cross inside and say me the following error message if I pass the mouse over the icons:
    Multiple annotations found at this line:
    - cvc-elt.1: Cannot find the declaration of element 'beans'.
    - schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-3.0.xsd',
    because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>


    The second error is at line 13:
    Code:
    <context:component-scan base-package="net.viralpatel.spring3.controller" />
    This error is reported by yellow triangle icon with an exclamation mark inside and say me the following error message if I pass the mouse over the icons:

    schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/context/spring-context-3.0.xsd',
    because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.


    But if I run on server my project is run well and work right

    An other strange thing is that if I do a clean of my project this error disappear and appear again when STS end the validation process of my project (but if I run my project on server it still work well)...could be some STS settings? something about validation process?

    Tnx
    Andrea

  2. #2
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,637

    Default

    Hey Andrea!

    Do you have the Spring nature activated on your project? And what happens if you put the version of the XSD into the schemaLocation definition of your Spring XML file instead of using the versionless URL?

    -Martin
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

  3. #3
    Join Date
    Jun 2010
    Posts
    119

    Default

    Quote Originally Posted by Martin Lippert View Post
    Hey Andrea!

    Do you have the Spring nature activated on your project? And what happens if you put the version of the XSD into the schemaLocation definition of your Spring XML file instead of using the versionless URL?

    -Martin
    What do you mean when you ask me if I have Spring nature actived on my project?

    I think that I am using the versionless URL, if you see in my code you can see that I have try to delete the XSD version number...

    Maybe I have some XSD version number in web.xml file:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        id="WebApp_ID" version="2.5">
        <display-name>Spring3MVC</display-name>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
     
        <servlet>
            <servlet-name>spring</servlet-name>
            <servlet-class>
                org.springframework.web.servlet.DispatcherServlet
            </servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>spring</servlet-name>
            <url-pattern>*.html</url-pattern>
        </servlet-mapping>
    </web-app>
    Have you some idea?

    Thank you very much
    Andrea Nobili

  4. #4
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,637

    Default

    Hey Andrea!

    With the versioned XSDs I meant the Spring namespace definitions at the top of your config file:

    Quote Originally Posted by AndreaNobili View Post
    This is my spring-servlet.xml file content:
    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"
       
        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">
    I would try to define:

    Code:
        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">
    for example in case you are using Spring 3.0.

    Can you try that?
    Another issue might be the network access. Are you behind a proxy/firewall? In that case, you should also define your proxy settings in the Eclipse/STS preferences.

    HTH,
    -Martin
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •