1. 程式人生 > >Axis做的Service客戶端部署在weblogic上相容問題

Axis做的Service客戶端部署在weblogic上相容問題

昨天部署應用時才發現問題,應用中新加的Axis做的客戶端在WebLogic Server 版本: 10.3.5.0上報錯具體的堆疊資訊如下:
2013-05-18 13:23:49,580 [TIBCO EMS Session Dispatcher (9350847568)] ERROR [gov.chinapost.ems.ebay.services.impl.OutPartnerServiceImpl] - ; nested exception is:
        java.lang.NullPointerException
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.lang.NullPointerException
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}stackTrace:java.lang.NullPointerException
        at org.apache.axis.message.MessageElement.addTextNode(MessageElement.java:1388)
        at org.apache.axis.message.SOAPHandler.addTextNode(SOAPHandler.java:148)
        at org.apache.axis.message.SOAPHandler.endElement(SOAPHandler.java:112)
        at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
        at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
        at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
        at org.apache.axis.client.Call.invoke(Call.java:2767)
        at org.apache.axis.client.Call.invoke(Call.java:2443)
        at org.apache.axis.client.Call.invoke(Call.java:2366)
        at org.apache.axis.client.Call.invoke(Call.java:1812)
        at com.ebay.apacshipping.ems.ShippingServiceSoapStub.updateOrderStatus(ShippingServiceSoapStub.java:225)
        at gov.chinapost.ems.ebay.services.impl.OutPartnerServiceImpl.receiveMessage(OutPartnerServiceImpl.java:139)
        at gov.chinapost.ems.msg.adapter.jms.impl.MessageReceiver$1.onMessage(MessageReceiver.java:75)
        at com.tibco.tibjms.TibjmsSession._submit(TibjmsSession.java:3567)
        at com.tibco.tibjms.TibjmsSession._dispatchAsyncMessage(TibjmsSession.java:1963)
        at com.tibco.tibjms.TibjmsSession$Dispatcher.run(TibjmsSession.java:3098)

        {http://xml.apache.org/axis/}hostname:dmz-app-03



雖然在網上找到的有解決辦法但是對於我這邊伺服器來說都不太適合我,因為他們要修改weblogic的啟動指令碼什麼的,畢竟一個weblogic上不可能只部署一個應用,那麼多的應用對於我來說是未知的,所以我不能冒險去改公共用的資源,問題的根本原因就是saaj.jar,如果應用中還有其他介面是用axis2做的話(畢竟不是一個人寫的每個人都有習慣所以一個應用上有兩種Service的方法)應該有geronimo-saaj_1.3_spec-1.0.1.jar包,我的是後者,這個包跟weblogic本身的webservices.jar中的javax.xml.soap包重複,我很奇怪weblogic為什麼要把別人的包拷貝到自己的包裡面,然後包路徑什麼都沒改,這樣就造成了衝突,如果你的應用的weblogic.xml中加的有<prefer-web-inf-classes>true</prefer-web-inf-classes>的話,就表示weblogic會先載入應用中的jar包最後載入自己的jar包,我的是配的true。這個時候我就想到了一個解決辦法,把weblogic的webservices.jar包拷貝到我的專案中,然後把包裡面的javax.xml.soap給刪除掉,這樣保證weblogic一定會先載入geronimo-saaj_1.3_spec-1.0.1.jar或saaj.jar包,重新部署,啟動就OK了。