当前位置: 代码迷 >> 综合 >> does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Up
  详细解决方案

does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Up

热度:57   发布时间:2023-12-08 01:26:00.0

java spring配置文件时出现一下异常

 

18:08:38 ServerMonitor - server ip:192.168.1.160 192.168.10.1 192.168.126.1
18:08:38 ClassPathXmlApplicationContext - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1891d8f: display name [org.springframework.context.support.ClassPathXmlApplicationContext@1891d8f]; startup date [Tue Aug 21 18:08:38 CST 2012]; root of context hierarchy
18:08:38 XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [applicationContext.xml]
18:08:38 ServerMonitor - 加载配置文件失败
org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from class path resource [applicationContext.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.crimson.jaxp.DocumentBuilderFactoryImpl@1be2d65] 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: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 com.wiselong.tools.servermonitor.ServerMonitor.initBean(ServerMonitor.java:90)
 at com.wiselong.tools.servermonitor.ServerMonitor.main(ServerMonitor.java:217)
Caused by: javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.crimson.jaxp.DocumentBuilderFactoryImpl@1be2d65] 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: 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)
 ... 17 more

 

此问题在网上找了很多帖子都没有找到解决方案,后来发现是jar包冲突的问题
原因是:j2ee1.3xxx.jar或j2ee1.4xxx.jar与xmlxxx.jar相关的jar包有冲突
解决方案一:删除j2ee1.3xxx.jar或j2ee1.4xxx.jar即可解决

解决方案二:先加载xmlxxx.jar相关的jar包,再加载j2eexxx.jar相关的jar包,通过加载jar包的先后顺序来解决冲突问题

  相关解决方案