2014-04-24 21 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文件是否有效。

希望这会有帮助。