05-01-2014 01:30 AM
This is the error message that I get when attaching large blob file in a Document.
02:01:12.922 [main] DEBUG o.a.h.i.conn.DefaultClientConnection - Connection 0.0.0.0:41419<->10.30.10.175:8080 closed 02:01:12.922 [main] DEBUG o.a.h.i.c.PoolingClientConnectionManager - Connection released: [id: 3][route: {}->http://10.30.10.175:8080][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20] 02:01:12.922 [main] INFO tv.migo.transcode.util.RESTUtils - org.nuxeo.ecm.automation.client.RemoteException: Server Error 02:01:12.922 [main] INFO tv.migo.transcode.util.RESTUtils - uploading failed.
This is my code from http://doc.nuxeo.com/display/NXDOC56/Using+Nuxeo+Automation+Client
HttpAutomationClient automationClient = new HttpAutomationClient("http://10.30.10.175:8080/nuxeo/site/automation"); Session session = automationClient.getSession("Administrator", "Administrator");
try {
// Get The Root
Document root = (Document) session.newRequest("Document.Fetch").set("value", destinationPath).execute();
// Create a File Document
Document documentFolder = (Document) session.newRequest("Document.Create").setInput(root).set("type", "asset").set("name", filename)
.set("properties", "dc:title=" + TRANSCODED_DIR).execute();
// Create a File Document
Document document = (Document) session.newRequest("Document.Create").setInput(documentFolder).set("type", "File").set("name", filename)
.set("properties", "dc:title=" + filename).execute();
// Upload The file
FileBlob fb = new FileBlob(file);
fb.setMimeType("text/xml");
// uploading a file will return null since we used HEADER_NX_VOIDOP
session.newRequest("Blob.Attach").setHeader(Constants.HEADER_NX_VOIDOP, "true").setInput(fb).set("document", document.getPath()).execute();
logger.info("Done!");
automationClient.shutdown();
logger.info("uploading success");
return document;
} catch (Exception e) {
logger.info(e.toString());
}
logger.info("uploading failed.");
This code works on smaller size file. I'm wondering if its the Connection-keep-alive should be set true. But how do I do that on Automation Client?
05-06-2014 04:12 AM
5.9.3 is the version. Tomcat is the server used.
05-06-2014 04:36 PM
Do the same file uploads work correctly via the Nuxeo user interface?
05-06-2014 11:20 PM
Yes. The web gui works. I can also upload small size files via blob attach in automation client.
05-07-2014 11:42 AM
Weird. If you change logger.info(e.toString()); in your error handler to print the entire stacktrace and original exception, maybe the cause will be more clear. Really the try/catch does nothing for you in this snippet, so an alternative to printing the whole trace is to just remove the try/catch.
Attention: Blogs & Forums are in READ-ONLY mode from Oct 9-19 as we transition to our new platform. Learn more.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.