spring问题--Unable to validate using XSD
问题描述:
ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from ServletContext resource [/WEB-INF/conf/applicationContext-dataSource.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [gnu.xml.dom.JAXPFactory@5e7663] 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.
Caused by:
javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [gnu.xml.dom.JAXPFactory@5e7663] 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.
解决方法:
--->直接删掉你导入的jfreechat的包,gunjaxp.jar
按错误提示中说的“Are you running on Java 1.4 or below with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support”,我的jdk版本过低?!我安装的可是1.5,在dos窗口中java -version一查看,还真是1.4,这才明白过来,是我刚刚装的Oracle搞得鬼。于是,将环境变量中oracle的jre删除掉。
重试,还错?而且还是报一模一样的错误。晕死>_Unable to validate using XSD: Your JAXP provider [gnu.xml.dom.JAXPFactory@5e7663] does not support XML Schema.”把这个错误贴到google上,果然解决方法一大堆,不外乎以下几种:
1,Xerces版本可能过低,导致解析spring的配置文件时候报错,靠这句话本身就有问题,spring要解析自己的xml文档,干嘛拿一个不能解析的解析工具啊?脑子秀逗了。不过,话虽如此,我还是档了一对不同版本的Xerces的jar报一个一个试,失败!
2,Xerces与j2ee里的xmls.api有冲突,那到底应该删除掉哪个呢?不管了,试吧,先把Xerces删除掉,重启tomcat,失败!跑到myeclipse里将其xmls.api包删除,失败!真累啊
3,我实在找不到第三个错误的可能性了,怎么办,算了,豁出去了,一个一个单词看错误信息吧,我看啊看啊,终于:一个下午过去了,继续看啊看啊Your JAXP provider [gnu.xml.dom.JAXPFactory@5e7663] does not support XML Schema. [b]gnu,[/b]好像在那儿见过啊,快点想起来,对了,jfreechart里好像有这个东东,一看果然gunjaxp.jar,jfreechart里有这个东东,删掉它试试,成功了