配置了spring的java application启动出错

今天启动CSS的后台服务CssServer的时候,出现以下错误:

ERROR 2010-02-22 21:46:48 (JobManager.java:49) - Parser configuration exception parsing XML from class path resource [common/spring/conf/auto-transaction.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.crimson.jaxp.DocumentBuilderFactoryImpl@44f787] 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.
org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from class path resource [common/spring/conf/auto-transaction.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.crimson.jaxp.DocumentBuilderFactoryImpl@44f787] 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: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:423)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
    at common.spring.PosBeanFactory.initContext(PosBeanFactory.java:18)
    at common.spring.PosBeanFactory.getBeanFactory(PosBeanFactory.java:27)
    at common.JobManager.loadAll(JobManager.java:39)
    at common.CssServer.main(CssServer.java:28)
Caused by: javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.crimson.jaxp.DocumentBuilderFactoryImpl@44f787] 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)
    ... 17 more
Caused by: java.lang.IllegalArgumentException: No attributes are implemented
    at org.apache.crimson.jaxp.DocumentBuilderFactoryImpl.setAttribute(DocumentBuilderFactoryImpl.java:93)
    at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(DefaultDocumentLoader.java:99)
    ... 19 more

 

--------------------------

to be solved….

--------------------------

一小时后被我搞定,通过把JAXP相关的jar包在classpath中的order提前,包括XercesImpl.jar,Xalan.jar,xml-api.jar。

之前我并不理解crimson的用途,经过google让我有了一些了解。对自己的环境我能确定的是所有的jar包都有了,而且原先包含这些jar都是能正确运行的,也就没有必要删除多余的jar,后来在google上搜到一个给了我帮助的帖子,上面说到“Jaxp只是个接口(规范),实际的实现是在Xerces或Crimson",同时,“Crimson继承自Tr-X项目,性能太差,确已快淘汰,但未包含在Xerces中”,我的classpath没有crimson包(这里还有一点疑点,为什么会去找crimson?),但我想到把Xerces往前移应该就解决问题了。果然。

感谢google!        2010-02-22 22:30

你可能感兴趣的:(application)