Announcement Announcement Module
Collapse
No announcement yet.
sax parser unable to read spring xsd Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • sax parser unable to read spring xsd

    Running on JBOSS-4.0.5GA with xfire-2.1.6 soap stack.

    Changing to spring 2.5 declarative transaction and have an application context doc (transaction.xml) with the following beans tag;

    <?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:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schem...ing-tx-2.5.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-2.5.xsd
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd" ........

    which gets the following error when the server starts:

    org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-2.5.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 URIs are reachable via browser.
    server has no problem with earlier dtd based docs.

    looked at proxy setting, it looks okay.
    anyone have similar experience?

  • #2
    It should not even try to access the remote document. Spring usually reads the schemas from the class path.

    Joerg

    Comment


    • #3
      Problem solved: unprintable character in the header

      Comment


      • #4
        Hello,

        Running on JBOSS-5.0.0.GA, I'm facing the same kind of problem :

        Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-2.5.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>. @ vfszip:/D:/SocleTechniqueJEE/jboss-5.0.0.GA/server/default/deploy/PetClinicWeb.war/WEB-INF/applicationContext-hibernate.xml[9,106]

        Whereas link to the xsd is OK :

        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"
        		xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
        		xsi:schemaLocation="
        			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        			http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
        			http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
        			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
        Please give more accurate explanations on how you did solve this issue,

        Kind regards,

        tstebut

        Comment


        • #5
          The XSDs are not read from the URI. There is a spring.schemas file in the Spring META-INF folder, which points these URIs to the location in the classpath. The problem could be either that something is preventing the XSDs to be available from the classpath.

          Could you post the complete stack trace?

          Comment


          • #6
            have this problem resolved? I am facing same kind of problem. I shall be very thankful if u share the solution.

            Comment


            • #7
              I didn't look into it much, but either or your XML contains invalid characters - say a unicode unescaped character or as a workaround you could use the DTD format in your Spring XMLs.

              HTH!

              Comment


              • #8
                Thanks San !.... problem is resolved, it seems right that there are some invalid characters issue. I just remove some spaces in application-servlet.xml after <?xml version="1.0" encoding="UTF-8"?>. But still I strange about this problem.

                Comment


                • #9
                  Invalid characters is not the only reason. I got similar error because a required library was missing.

                  Code:
                  org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/integration/xml/spring-integration-xml-1.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>
                  Fixed by adding org.springframework.integration.xml-1.0.4.RELEASE.jar

                  So looks like it is a misleading error message that just means something is wrong somewhere.

                  Comment


                  • #10
                    Originally posted by sangupta View Post
                    The XSDs are not read from the URI. There is a spring.schemas file in the Spring META-INF folder, which points these URIs to the location in the classpath. The problem could be either that something is preventing the XSDs to be available from the classpath.

                    Could you post the complete stack trace?
                    have this problem resolved? I am facing same kind of problem. I shall be very thankful if u share the solution.

                    Comment


                    • #11
                      had the same problem with spring-context.xsd:
                      Failed to read schema document 'http://www.springframework.org/schema/context/spring-context.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 used the version independent namespace configuration:

                      <beans xmlns=... ...
                      xsi:schemaLocation="...
                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

                      After insert of the version dependent URI the error disappeared:

                      <beans xmlns=... ...
                      xsi:schemaLocation="...
                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

                      not quite satisfactory...

                      Comment

                      Working...
                      X