程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> 關於JAVA >> 菜鳥調錯(三) Jboss與jdk版本不兼容導致WebService調用出錯

菜鳥調錯(三) Jboss與jdk版本不兼容導致WebService調用出錯

編輯:關於JAVA

環境:

jdk1.6

Jboss 5.1.0.GA

問題描述:

EJB發布webserivce已經成功,並且能夠成功訪問wsdl文件;

使用axis1自帶的sample/client下的類DynamicInvoker測試,程序報錯。

錯誤信息:

客戶端:

Exception in thread "main" AxisFault

faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException

faultSubcode:

faultString: org.xml.sax.SAXParseException: Premature end of file.

faultActor:

faultNode:

faultDetail:

{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: Premature end of file.

at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)

at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)

at javax.xml.parsers.SAXParser.parse(Unknown Source)

服務器(Jboss)端錯誤信息:

ERROR [SOAPFaultHelperJAXWS] SOAP request exception

java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage

at javax.xml.soap.SOAPMessage.setProperty(Unknown Source)

at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:87)

at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:215)

at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:193)

at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:455)

at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:295)

at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)

at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)

at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process

(SecurityContextEstablishmentValve.java:126)

at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke

(SecurityContextEstablishmentValve.java:70)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

at java.lang.Thread.run(Unknown Source)

解決方案:

下載jboss-5.1.0.GA-jdk6,並將JBOSS_HOME\lib\endorsed下的幾個以Jboss開頭的jar包分別復制到JAVA_HOME\lib\endorsed 和 JRE_HOME\lib\endorsed目錄下。兩個lib目錄中可能都沒有endorsed文件夾(反正我的沒有),那就自己新建一個。

需要復制的jar包:

jbossws-native-jaxrpc.jar

jbossws-native-jaxws.jar

jbossws-native-jaxws-ext.jar

jbossws-native-saaj.jar

注意:從eclipse啟Jboss需要在jre下放置這些包,從外部啟Jboss需要在jdk下放置上面的jar包。

開始只注意到客戶端報的錯誤,於是根據錯誤信息就在網上搜尋解決辦法,可是找到的資料千奇百怪,說什麼的都有。後來賈琳一句話提醒了我,他問我Jboss報什麼錯誤,這時我才想起來還有Jboss的事呢。後來他把他之前遇到類似錯誤的博客發給我,我按照上面的辦法弄了弄,不過還是發現有點小問題(從外部啟Jboss還是報錯)。後來參考一篇網友的博客解決了這個問題。這篇文章很詳細的講解了出現這個錯誤的原因,有興趣的朋友可以看看。

作者:cnblogs 劉水鏡

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved