Announcement Announcement Module
No announcement yet.
Help with an error on validating using XSD Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with an error on validating using XSD

    I'm writting a unit test that extends AbstractTransactionalDataSourceSpringContextTests and am getting
    an error during the parse of my applicationContext.xml file.

    The exception is copied below. I'm having trouble understanding what I need to do to fix my problem. I am running Java 1.4 but I don't know what
    parser I'm using. Upgrading to Java 1.5 isn't an option.

    I've been wondering if I can disable the validation but haven't found a way to do that. I'm using spring 2.1-m2. My xml file starts with:

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns=""

    Thanks for any help you can give.

    Caused by: javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.crimson.jaxp.DocumentBuilderFactoryImpl @121177e] does not support XML Schema. Are you running on Java 1.4 or below with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.
    at org.springframework.beans.factory.xml.DefaultDocum entLoader.createDocumentBuilderFactory(DefaultDocu
    at org.springframework.beans.factory.xml.DefaultDocum entLoader.loadDocument( 72)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio
    ... 24 more

  • #2
    I've learned one thing about my post. The parser/provider is printed right in the exception and is org.apache.crimson. I'd have a hard time adding libraries to this project so I'm still looking at disabling the validation.


    • #3
      Don't think about disabling validation at all. Try to use a more recent version of a parser like Xerces than the default one that comes with the JDK. Therefore you can make use of the so-called endorsed lib directory. There is no need to switch to Java 1.5.



      • #4
        Your's is the prefered solution but
        I've already been slapped on the wrist for upgrading or changing libraries
        on this project so I don't feel like doing it again. I ended up disabling the
        validation - not great but it allows me to continue with the unit testing.

        For the record, I overloaded createApplicationContext(String[] locations)
        in my test class and set the validation mode there. Here is the code:

            protected ConfigurableApplicationContext createApplicationContext(String[] locations) {
                GenericApplicationContext context = new GenericApplicationContext();
                XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context);
                return context;