Results 1 to 2 of 2

Thread: Problem reading spring-context-2.1.xsd

  1. #1
    Join Date
    Mar 2007
    Posts
    128

    Default Problem reading spring-context-2.1.xsd

    I'm upgrading my app from 1.4 to 1.5, and I'm trying to add in Annotations. I saw that 2.1 M2 had @autowired and @Resources, so I was going to try to use them.

    Right now I'm only trying out @autowired. I can't seem to get the compiler to recognize @Resources. That's another issue that I'll tackle after this.

    In the reference manual (p.85, section 3.10), it says to set up the context XML like so:
    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:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-2.1.xsd">
    <context:annotation-config/>
    </beans>
    When I tried to start the app I get this error:
    Code:
    org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/context/spring-context-2.1.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>.
    I went to my browser and put in the xsd and it came up fine. Does anyone have any ideas?

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    The @Resource annotation is included in common-annotations.jar. This seems to be a fairly common question as I just replied to 2 other posts ...
    (http://forum.springframework.org/showthread.php?t=39713 and http://forum.springframework.org/showthread.php?t=39347)

    As far as the parser error, can you check if you have *only* spring 2.1 on the classpath?

Posting Permissions

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