問題描述
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.
解決方法:
按錯誤提示中說的“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搞得鬼。于是,將環(huán)境變量中oracle的jre刪除掉。
重試,還錯?而且還是報一模一樣的錯誤。暈死>_Unable to validate using XSD: Your JAXP provider [gnu.xml.dom.JAXPFactory@5e7663] does not support XML Schema.”把這個錯誤貼到google上,果然解決方法一大堆,不外乎以下幾種:
1,Xerces版本可能過低,導(dǎo)致解析spring的配置文件時候報錯,靠這句話本身就有問題,spring要解析自己的xml文檔,干嘛拿一個不能解析的解析工具???腦子秀逗了。不過,話雖如此,我還是檔了一對不同版本的Xerces的jar報一個一個試,失敗!
2,Xerces與j2ee里的xmls.api有沖突,那到底應(yīng)該刪除掉哪個呢?不管了,試吧,先把Xerces刪除掉,重啟tomcat,失?。∨艿絤yeclipse里將其xmls.api包刪除,失??!真累啊
3,我實(shí)在找不到第三個錯誤的可能性了,怎么辦,算了,豁出去了,一個一個單詞看錯誤信息吧,我看啊看啊,終于:一個下午過去了,繼續(xù)看啊看啊Your JAXP provider [gnu.xml.dom.JAXPFactory@5e7663] does not support XML Schema. [b]gnu,[/b]好像在那兒見過啊,快點(diǎn)想起來,對了,jfreechart里好像有這個東東,一看果然gunjaxp.jar,jfreechart里有這個東東,刪掉它試試,成功了