All:
I'm having an issue where a Spring application, when run from the command line, can not find an XML parser that supports XSD validation. This does not occur within Eclipse during development / unit testing. Eclipse and the command line are both referring to the same JDK (java-6-sun-1.6.0.13). I'm using Ivy with the Spring Enterprise Bundle Repository and pulling in cyberneko for HTML parsing[1]. One of Neko's dependencies is Xerces 2.8.1 which, while slightly older than the current 2.9.1, is still perfectly capable of XSD validation. It is this dependency that results in the exception below.
If I add an exclusion to my Ivy file so Xerces is not included (banking on what's included with the JDK, itself), the code compiles, runs, and properly parses the Spring configs (with schema validation), but Neko fails due to org.apache.xerces.DOMParser not being found.
Again, all of this works fine in Eclipse so clearly it's a classpath issue of some kind. I've tried doing things like logging the java.class.path property from the unit tests in Eclipse and running with things in that order, but that produces similar results.
Note the specific line in the stack trace that shows that it's using Xerces' org.apache.xerces.jaxp.DocumentBuilderFactoryImpl class which should suffice.
[1] http://www.springsource.com/reposito... rsion=1.9.11
Everything else I've found on the subject says to stick xerces in the JDK/JRE endorsed directory, but this seems hackish and not necessary. Am I missing something?Code:[main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [META-INF/spring/xxx.xml] [main] ERROR xxx.Application - Error running application. Exception follows. org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from class path resource [META-INF/spring/xxx.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@5f8172] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) forfull XSD support. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) 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.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) at xxx.Application.run(Unknown Source) at xxx.Application.main(Unknown Source) Caused by: javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@5f8172] 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:396) ... 15 more Caused by: java.lang.IllegalArgumentException: Feature 'http://apache.org/xml/features/validation/schema' is not recognized. at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.setAttribute(Unknown Source) at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(DefaultDocumentLoader.java:99) ... 17 more
Any help is greatly appreciated.


Reply With Quote