2013-10-10 112 views
2

在使用播放WS調用Web服務,它是扔在遊戲框架調用Web服務拋出執行異常

[RuntimeException: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: [email protected]; line: 1, column: 2]] 

環境:Ubuntu的12.04 + Java的1.7 +播放框架2.2.0

回答

2

這異常實際上是JsonParseException這意味着String你實際上試圖解析不是一個有效的JSON。出現此問題的原因和接收響應是XML格式或HTML,它包含了通常當服務不可用,該類型的響應字符<

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> 
<html><head> 
<title>404 Not Found</title> 
</head><body> 
<h1>Not Found</h1> 
<p>The requested URL /123 was not found on this server.</p> 
<p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p> 
</body></html> 

<data contentType="null" contentLength="0"><![CDATA[]]></data> 

在將其與Play框架集成之前,嘗試通過REST客戶端(如SOAP UI或PostMan)調用Web服務。

相關問題