WebService的axis客户端调用时出错解决方法
发布时间:2020-12-16 23:05:07 所属栏目:安全 来源:网络整理
导读:Caused by: javax.xml.parsers.FactoryConfigurationErro r: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryIm pl not found at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source) at org.springframework.beans.factory.xml
Caused by: javax.xml.parsers.FactoryConfigurationErro
at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source) at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFac at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:68) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:361) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:313) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:290) at org.springframework.beans.factory.support.AbstractBeanDefinitionRe at org.springframework.beans.factory.support.AbstractBeanDefinitionRe at org.springframework.beans.factory.support.AbstractBeanDefinitionRe at org.springframework.context.support.AbstractXmlApplicationCo at org.springframework.context.support.AbstractXmlApplicationCo at org.springframework.context.support.AbstractRefreshableAppli at org.springframework.context.support.AbstractApplicationConte at org.springframework.context.support.AbstractApplicationConte at org.springframework.context.support.ClassPathXmlApplicationC at org.springframework.context.support.ClassPathXmlApplicationC at ws.cxf.client.SurveyServiceClient.main(SurveyServiceClient.java:22) 解决方法设置两个属性(javax.xml.parsers.DocumentBuilderFactory,javax.xml.parsers.SAXParserFactory)值如下:
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", System.setProperty("javax.xml.parsers.SAXParserFactory",sans-serif"> 再运行就没有错了. 最后发现原因是我使用MyEclipse创建项目时引用了J2EE 1.4 Library Container库(JAVA构建路径-->库) 使得sun.boot.class.path增加了myelipse下的jar文件,然后就把javax.xml.parsers.DocumentBuilderFactory变量的值设为org.apache.xerces.jaxp.DocumentBuilderFactoryIm 即还有第二种解决方法,就是去掉J2EE 1.4 Library Container库,编译,再运行就没有错了. (JDK版本为1.5与6.0都测试通过). 请参考我的另外两篇转载的文章 DocumentBuilderFactory以及SAXParserFactory具体实现的查找步骤 http://lengweiping1983.javaeye.com/blog/248553 XML api折射出sun与IBM的恩仇 http://lengweiping1983.javaeye.com/blog/248560 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |