Reputation: 23
When I try to read a text document from MarkLogic database using it's URI..I get get below specified exception:
[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)
Upvotes: 0
Views: 737
Reputation: 49
I got the same error while loading a JSON file in MarkLogic database. I found that the error was that my JSON file wasn't valid. There were some syntax errors in my JSON file. What I could recommend you to do is that you check if your XML file is valid.
Hope this will be helpfull.
Upvotes: 0
Reputation: 7335
User3569076:
It sounds like the request is failing but the Java API can't parse the error message because the error message isn't XML.
When you create the database client, are you specifying the hostname and port for a REST API server?
If not, here are the instructions for creating a REST API server for a database:
http://docs.marklogic.com/guide/rest-dev/service#id_12021
You can test the availability of the REST API by trying to get a document from the host and port in your web browser:
http://docs.marklogic.com/REST/GET/v1/documents
Hoping that helps,
Erik Hennum
Upvotes: 2