7 Replies Latest reply on Apr 27, 2010 4:09 AM by Nes Yarug

    AS 5.1.0.GA fails to parse Spring schemas, on AS 4.2.3.GA al

    Nes Yarug Newbie

      Hi,

      I'm trying to migrate my Spring-based webapp from JBoss AS 4.2.3.GA to JBoss AS 5.1.0.GA. I'm running into the following on startup:

      Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Failed to parse schema for nsURI=http://www.springframework.org/schema/context, baseURI=null, schemaLocation=null

      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Failed to parse schema for nsURI=http://www.springframework.org/schema/context, baseURI=null, schemaLocation=null

      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: -1:-1 1:55 White spaces are required between publicId and systemId.

      Would anyone here know why?

      This is the header of for example applicationContext.xml:

      <?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"
       xmlns:aop="http://www.springframework.org/schema/aop"
       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/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">


      Many thanks for your support,
      Nes

        • 1. Re: AS 5.1.0.GA fails to parse Spring schemas, on AS 4.2.3.G
          Wolfgang Knauf Master

          Hi,

          just some guessing...

          You might try to remove the newline and spaces between "xsi:schemaLocation="...." and the first id/schemalocation pair.

          If this does not work: try to specify the schema locations on the first element of each xsd, as seen here: http://lists.w3.org/Archives/Public/www-xml-schema-comments/2000JulSep/0235.html. Maybe the JBoss XML parser does not like multiple schema locations...

          Hope this helps

          Wolfgang

          • 2. Re: AS 5.1.0.GA fails to parse Spring schemas, on AS 4.2.3.G
            Nes Yarug Newbie

            Hi Wolfgang,

            Thank you for your suggestions. Have tried them all with no result unfortunately.

            Nes

            • 3. Re: AS 5.1.0.GA fails to parse Spring schemas, on AS 4.2.3.G
              Wolfgang Knauf Master

              Hi Nes,

              I don't know Spring, so I can just try to reproduce what you post here. I tried to deploy a simple webapp with just one file "applicationContext.xml" with the content of your sample, and this worked.

              I also tried to deploy the spring 2.5 sample "imagedb", and this also worked besides database errors because I don't have a MySQL database. The sample's applicationContext.xml has the same header as yours.

              Could you give the "imagedb" sample a try?

              Best regards

              Wolfgang

              • 4. Re: AS 5.1.0.GA fails to parse Spring schemas, on AS 4.2.3.G
                Nes Yarug Newbie

                I've now tried to run imagedb on JBoss 5.1.0 in a default server and there are no errors. Seems I have some more investigation to do and compare...

                Thanks for the suggestion.

                • 5. Re: AS 5.1.0.GA fails to parse Spring schemas, on AS 4.2.3.G
                  Nes Yarug Newbie

                  By the process of elimination I've now narrowed it down to a specific file, but can't for the life of me figure out what could be wrong.

                  The problematic file is my Hibernate/DAO configuration applicationContext-hibernate.xml. Strange however that it seems to fail with the "White spaces" error on the XSD for the first non-default namespace in the XML file.

                  Here is my "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:context="http://www.springframework.org/schema/context"
                   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/tx
                   http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">


                  When the first non-default namespace tag starts with "<context:", in my case:

                  <context:annotation-config />


                  the error is:

                  Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Failed to parse schema for nsURI=http://www.springframework.org/schema/context, baseURI=null, schemaLocation=null

                  When I remove that line so that the first non-default namespace tag starts with "<tx:", in my case:

                  <tx:annotation-driven transaction-manager="transactionManager" />


                  the error is:

                  Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Failed to parse schema for nsURI=http://www.springframework.org/schema/tx, baseURI=null, schemaLocation=null

                  Does that make sense to anyone?

                  • 6. Re: AS 5.1.0.GA fails to parse Spring schemas, on AS 4.2.3.G
                    Alexis Hassler Apprentice

                    I have the same exception with an applicationContext file in /WEB-INF, but it works fine when putting the context file in an classpath: location or elsewhere but /WEB-INF.

                    • 7. Re: AS 5.1.0.GA fails to parse Spring schemas, on AS 4.2.3.G
                      Nes Yarug Newbie

                      Alexis, yes that is the solution (or rather workaround).

                       

                      Somehow I didn't understand it before as I had in my mind that Spring  was hardwired to read these files from WEB-INF and I misread "a  directory under WEB-INF" for "in WEB-INF".

                      Anyhow, I moved the problematic files into a new directory  WEB-INF/appctx, updated my web.xml:

                      <context-param>
                      <param-name>contextConfigLocation</param-name>
                      <param-value>/WEB-INF/appctx/applicationContext-hibernate.xml  /WEB-INF/appctx/applicationContext-security.xml...

                      and the "White spaces are required between publicId and systemId"  disappeared

                      I then had to go through a whole bunch of other issues, but I'm running  on JBoss 5.1.0 now.

                      Many thanks for all your support.
                      Nes