Saxon+Spring - Illegal Argument Exception


  • Anonymous

    I'm trying to move from Xalan to Saxon for the XSLT 2.0 support. I no longer
    have any Xalan artifacts in the environment and instead am using Saxon On startup, I'm seeing this exception. Note however that
    transformations seem to be working fine. I'd just like to get this error
    cleared up in case it's causing an issue I just haven't run into yet. Thanks!

    2012-01-31 10:10:34,172 ERROR [org.springframework.web.context.ContextLoader][main] - Context initialization failed
    org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from ServletContext resource [/WEB-INF/config/app-config-tomcat.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [net.sf.saxon.dom.DocumentBuilderFactoryImpl@9c8a67] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(
        at org.apache.catalina.core.StandardContext.listenerStart(
        at org.apache.catalina.core.StandardContext.start(
        at org.apache.catalina.core.ContainerBase.addChildInternal(
        at org.apache.catalina.core.ContainerBase.addChild(
        at org.apache.catalina.core.StandardHost.addChild(
        at org.apache.catalina.startup.HostConfig.deployWAR(
        at org.apache.catalina.startup.HostConfig.deployWARs(
        at org.apache.catalina.startup.HostConfig.deployApps(
        at org.apache.catalina.startup.HostConfig.start(
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
        at org.apache.catalina.core.ContainerBase.start(
        at org.apache.catalina.core.StandardHost.start(
        at org.apache.catalina.core.ContainerBase.start(
        at org.apache.catalina.core.StandardEngine.start(
        at org.apache.catalina.core.StandardService.start(
        at org.apache.catalina.core.StandardServer.start(
        at org.apache.catalina.startup.Catalina.start(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at org.apache.catalina.startup.Bootstrap.start(
        at org.apache.catalina.startup.Bootstrap.main(
    Caused by: javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [net.sf.saxon.dom.DocumentBuilderFactoryImpl@9c8a67] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.
        at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(
        at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(
        ... 37 more
    Caused by: java.lang.IllegalArgumentException: Unknown attribute [url][/url]
        at net.sf.saxon.Configuration.setConfigurationProperty(
        at net.sf.saxon.dom.DocumentBuilderFactoryImpl.setAttribute(
        at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(
        ... 39 more
  • Michael Kay
    Michael Kay

    It looks as if Spring (or an application using Spring) is using the JAXP
    mechanism to find a DOM implementation, and for some reason is finding the
    Saxon DOM implementation. This isn't a good idea, because Saxon's DOM
    implementation isn't a general-purpose one, and there are lots of things it
    doesn't support, for example update. So why is it finding it? Saxon doesn't
    register this implementation in the JAR file manifest, so I don't think it's
    finding it simply from the classpath search; that would suggest someone is
    setting the relevant system property. Setting the system property
    jaxp.debug="1" might shed more light as to why this DocumentBuilder is being

    It's possible that the problem is benign in that the DocumentBuilder is being
    loaded but isn't being used, or properties are being set on it that aren't
    actually needed; or perhaps Spring catches the exception and recovers by
    loading a different DocumentBuilder. But I agree with you, it would be better
    to stop it happening.


  • Anonymous

    Found and removed the system property... fixed. Thanks!