Project

Profile

Help

Saxon+Spring - Illegal Argument Exception

Added by Anonymous about 12 years ago

Legacy ID: #11110970 Legacy Poster: Chad Sturtz ()

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 9.1.0.8. 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![code]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(XmlBeanDefinitionReader.java:404) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:568) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:903) at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1282) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:807) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:519) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:579) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 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(DefaultDocumentLoader.java:102) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:70) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) ... 37 more Caused by: java.lang.IllegalArgumentException: Unknown attribute http://java.sun.com/xml/jaxp/properties/schemaLanguage at net.sf.saxon.Configuration.setConfigurationProperty(Configuration.java:3347) at net.sf.saxon.dom.DocumentBuilderFactoryImpl.setAttribute(DocumentBuilderFactoryImpl.java:49) at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(DefaultDocumentLoader.java:99) ... 39 more[/code]


Replies (2)

RE: Saxon+Spring - Illegal Argument Exception - Added by Anonymous about 12 years ago

Legacy ID: #11111073 Legacy Poster: Michael Kay (mhkay)

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 loaded. 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.

RE: Saxon+Spring - Illegal Argument Exception - Added by Anonymous about 12 years ago

Legacy ID: #11111472 Legacy Poster: Chad Sturtz ()

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

    (1-2/2)

    Please register to reply