用Axis2发布WebService遇到的坑

因为开发的系统是古老并且重量级的系统,jar包一大推引用及各种关联,集成axis2发布WebService服务的时候报错!

message org.apache.xerces.dom.DocumentImpl.getXmlStandalone()Z

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.axis2.dataretrieval.DataRetrievalException: org.apache.xerces.dom.DocumentImpl.getXmlStandalone()Z
	org.apache.axis2.dataretrieval.AxisDataLocatorImpl.getData(AxisDataLocatorImpl.java:85)
	org.apache.axis2.description.AxisService.getData(AxisService.java:2964)
	org.apache.axis2.description.AxisService.getWSDL(AxisService.java:1645)
	org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1413)
	org.apache.axis2.transport.http.ListingAgent.handleWSDLRequest(ListingAgent.java:327)
	org.apache.axis2.transport.http.ListingAgent.processListService(ListingAgent.java:183)
	org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)



  上网找了博客,说是xerces的jar冲突的原因居多,经测试,另起一个web项目,把xerces-2.4.0.jar删除掉,确实是可以,是其中之一的解决方法,
但是并不适用与笔者的正在开发中的系统,那个jar肯定是需要用到才会被引用在系统中的,所以说删除jar包方法不可行;
  继续摸索了一段时间,发现
xerces-2.4.0.jar 与 xmlParserAPIs-1.0.jar 相关jar包冲突,xmlParserAPIs-1.0.jar 有多重命名(xmlAPIs等等);
  最后解决方法:
  更新 xerces-2.4.0.jar 的版本 为 xerces-2_6_2.jar(下载地址:http://www.java2s.com/Code/Jar/x/Downloadxerces262jar.htm),重启项目就ok了。
  以上方法对本项目有效,不确定对其他情况是否有效,仅供参考。

猜你喜欢

转载自www.cnblogs.com/oablog/p/axis2.html