Announcement Announcement Module
Collapse
No announcement yet.
Why Eclipse\STS give me this error but the project run well? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why Eclipse\STS give me this error but the project run well?

    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 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-3.0.xsd
            http://www.springframework.org/schema/context 
            http://www.springframework.org/schema/context/spring-context-3.0.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-3.0.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 I run on server again my project...but it still work well...

    what could be the cause?

    Thank you very much

    Best regards
    Andrea Nobili

  • #2
    The answer is simply and is written down :

    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>

    Findout if you can reach this xsd from you i.e browser: http://www.springframework.org/schem...-beans-3.0.xsd
    Last edited by bieniek; Oct 30th, 2012, 04:20 AM.

    Comment


    • #3
      Originally posted by bieniek View Post
      The answer is simply and is written down :

      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>

      Findout if you can reach this xsd from you i.e browser: http://www.springframework.org/schem...-beans-3.0.xsd
      I can reach this xsd from my browser and I had try to reach this address berfore ask here...I think that could be some STS configuration problem...

      Comment


      • #4
        You don't need them to be accesible as they are loaded from STS or the classpath, however it depends on your STS version. However you haven't mentioned the STS version.

        Another note it is btw adviced to use the xsd without a version number, that way it will automatically resolve to the most recent version.

        Comment


        • #5
          Originally posted by Marten Deinum View Post
          You don't need them to be accesible as they are loaded from STS or the classpath, however it depends on your STS version. However you haven't mentioned the STS version.

          Another note it is btw adviced to use the xsd without a version number, that way it will automatically resolve to the most recent version.
          Hello Marten,
          I am using STS 3.1.0 version
          I do not know if I understand what you're saying me.

          You say me that I have to delete the following part of code from my <bean ...> tag in my sprig-servlet.xml configuration file?
          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"
          Or what?

          Thank you very much for your help

          Best regards
          Andrea

          Comment


          • #6
            You say me that I have to delete the following part of code from my <bean ...> tag in my sprig-servlet.xml configuration file?
            No... The VERSION... so remove -3.0 from the schema...

            Comment


            • #7
              Originally posted by Marten Deinum View Post
              No... The VERSION... so remove -3.0 from the schema...
              ah ok, so I have removed the version as you told me but the problems remain.

              Now the code of my <beans...> tag is the following:

              Code:
              <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" />
              I just noticed that the problem appears when STS end the validation process of my project...could be some STS settings? something about validation process?

              Tnx
              Andrea

              Comment


              • #8
                Originally posted by Marten Deinum View Post
                No... The VERSION... so remove -3.0 from the schema...
                ah ok, so I have removed the version as you told me but the problems remain.

                Now the code of my <beans...> tag is the following:

                Code:
                <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" />
                I just noticed that the problem appears when STS end the validation process of my project...could be some STS settings? something about validation process?

                Tnx
                Andrea

                Comment

                Working...
                X