cancel
Showing results for 
Search instead for 
Did you mean: 

Server error when attaching large blob file

marlon1300_
Champ in-the-making
Champ in-the-making

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?

5 REPLIES 5

Vladimir_Pasqui
Star Collaborator
Star Collaborator

Hi,

marlon1300_
Champ in-the-making
Champ in-the-making

5.9.3 is the version. Tomcat is the server used.

Steven_Huwig1
Star Contributor
Star Contributor

Do the same file uploads work correctly via the Nuxeo user interface?

marlon1300_
Champ in-the-making
Champ in-the-making

Yes. The web gui works. I can also upload small size files via blob attach in automation client.

Steven_Huwig1
Star Contributor
Star Contributor

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.