CXF報錯後,獨立解決->unwinding now Response was of unexpected text/html ContentType.

來源:互聯網
上載者:User

我的一個cxf項目, 在修改了web.xml的url-pattern後,調用報錯,如下:

 

2009-12-8 10:09:00 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
資訊: Interceptor has thrown exception, unwinding now Response was of unexpected text/html ContentType.  Incoming portion of HTML stream: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD><LINK type="text/css" rel="stylesheet" href="/terminal/TermWebservice/?stylesheet=1"><meta http-equiv=content-type content="text/html; charset=UTF-8"><title>CXF - Service list</title></head><body><span class="heading">Available services:</span><br/><table cellpadding="1" cellspacing="1" border="1" width="100%"><tr><td><span class="porttypename">TermWebservice</span><ul><li>getTermXml</li><li>getTermList</li></ul></td><td><span class="field">Endpoint address:</span> <span class="value">http://localhost:8088/terminal/TermWebservice/TermWebservice</span><br/><span class="field">Wsdl:</span> <a href="http://localhost:8088/terminal/TermWebservice/TermWebservice?wsdl">{http://webservice.terminalmonitor.synjones.com/}TermWebserviceImplService</a><br/><span class="field">Target namespace:</span> <span class="value">http://webservice.terminalmonitor.synjones.com/</span></td></tr></table></body></html>
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Response was of unexpected text/html ContentType.  Incoming portion of HTML stream: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD><LINK type="text/css" rel="stylesheet" href="/terminal/TermWebservice/?stylesheet=1"><meta http-equiv=content-type content="text/html; charset=UTF-8"><title>CXF - Service list</title></head><body><span class="heading">Available services:</span><br/><table cellpadding="1" cellspacing="1" border="1" width="100%"><tr><td><span class="porttypename">TermWebservice</span><ul><li>getTermXml</li><li>getTermList</li></ul></td><td><span class="field">Endpoint address:</span> <span class="value">http://localhost:8088/terminal/TermWebservice/TermWebservice</span><br/><span class="field">Wsdl:</span> <a href="http://localhost:8088/terminal/TermWebservice/TermWebservice?wsdl">{http://webservice.terminalmonitor.synjones.com/}TermWebserviceImplService</a><br/><span class="field">Target namespace:</span> <span class="value">http://webservice.terminalmonitor.synjones.com/</span></td></tr></table></body></html>
 at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
 at $Proxy43.getTermList(Unknown Source)
 at com.synjones.terminalmonitor.webservice.client.Client.main(Client.java:26)
Caused by: org.apache.cxf.interceptor.Fault: Response was of unexpected text/html ContentType.  Incoming portion of HTML stream: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD><LINK type="text/css" rel="stylesheet" href="/terminal/TermWebservice/?stylesheet=1"><meta http-equiv=content-type content="text/html; charset=UTF-8"><title>CXF - Service list</title></head><body><span class="heading">Available services:</span><br/><table cellpadding="1" cellspacing="1" border="1" width="100%"><tr><td><span class="porttypename">TermWebservice</span><ul><li>getTermXml</li><li>getTermList</li></ul></td><td><span class="field">Endpoint address:</span> <span class="value">http://localhost:8088/terminal/TermWebservice/TermWebservice</span><br/><span class="field">Wsdl:</span> <a href="http://localhost:8088/terminal/TermWebservice/TermWebservice?wsdl">{http://webservice.terminalmonitor.synjones.com/}TermWebserviceImplService</a><br/><span class="field">Target namespace:</span> <span class="value">http://webservice.terminalmonitor.synjones.com/</span></td></tr></table></body></html>
 at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:73)
 at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
 at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:641)
 at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2102)
 at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1980)
 at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1905)
 at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
 at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:600)
 at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
 at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
 at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:469)
 at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
 at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
 at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
 at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
 ... 2 more

 

 

主要是本人對錯誤描述不得要領, google一下關鍵資訊: Interceptor has thrown exception, unwinding now Response was of unexpected text/html ContentType.  但是沒有找到滿意答案, 後來一看,提示的資訊裡有http://localhost:8088/terminal/TermWebservice/TermWebservice?wsdl, 這個url比我配置的多了一個TermWebservice

就是我剛剛多配置的web.xml的url-pattern,為<url-pattern>/TermWebservice/*</url-pattern>, 了以前是<url-pattern>/*</url-pattern> 的, 所以問題找到了, 是url要多加一個TermWebservice,

      所以在調用的client端,加上TermWebservice這樣在調用就可以了, 因為錯誤比較誤導人,而網上查詢有沒有, 希望能幫到有同樣錯誤的兄弟。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.