2014-04-24 20 views
0

當我嘗試使用它來讀取MarkLogic數據庫中的文本文檔URI..I得到得到下面指定的異常:異常而讀取文檔的內容MarkLogic

[Fatal Error] :1:1: Content is not allowed in prolog. 
Exception in thread "main" com.marklogic.client.FailedRequestException: Local message: read failed: Bad Request. Server Message: Request failed. Unable to parse server error details 
    at com.marklogic.client.impl.JerseyServices.getDocumentImpl(JerseyServices.java:527) 
    at com.marklogic.client.impl.JerseyServices.getDocument(JerseyServices.java:393) 
    at com.marklogic.client.impl.DocumentManagerImpl.read(DocumentManagerImpl.java:210) 
    at com.marklogic.client.impl.DocumentManagerImpl.read(DocumentManagerImpl.java:144) 
    at com.marklogic.client.impl.DocumentManagerImpl.read(DocumentManagerImpl.java:114) 
    at com.marklogic.client.example.tutorial.Example_07_ReadText.main(Example_07_ReadText.java:49) 
+0

文檔中包含什麼內容? – user314104

回答

1

User3569076:

這聽起來如請求失敗,但Java API無法解析錯誤消息,因爲錯誤消息不是XML。

當您創建數據庫客戶端時,是否指定了REST API服務器的主機名和端口?

如果沒有,這裏有一個數據庫中創建一個REST API服務器的說明:

http://docs.marklogic.com/guide/rest-dev/service#id_12021

你可以試圖從主機和端口的文檔測試REST API的可用性在Web瀏覽器:

http://docs.marklogic.com/REST/GET/v1/documents

希望幫助,

Erik Hennum

+0

是的,MarkLogic服務器的主機名和端口號是正確指定的,當我指定一個目錄時,我能夠獲取大多數文檔的URI。但在將該目錄更改爲其他目錄後,我得到了超出指定的錯誤。 但現在不幸的是我沒有得到相同的錯誤,所以不能分享確切的情況。謝謝 – Poonam

0

我在加載MarkLogic數據庫中的JSON文件時遇到了同樣的錯誤。 我發現錯誤是我的JSON文件無效。我的JSON文件中有一些語法錯誤。 我可以推薦你做的是你檢查你的XML文件是否有效。

希望這會有幫助。