Page 1 of 1

XHTMLImporter.convert() On Server

PostPosted: Thu Feb 18, 2016 4:34 am
by currentg
XHTMLImporter.convert() works fine on our desktop machines but the application freezes when running on our server (Linux with Tomcat).

When it receives the HTML snippit:
<p style="text-align:center"><img alt="" src="http://150.125.181.105:8888/images/home/RTL2/Images/TST0101-1.png" style="height:132px; width:396px" /></p>
it cannot continue.

If I remove the image portion of the data it executes without error on the server.
Using the image link the server can display the image in HTML but XHTMLImporter.convert() cannot process it.

Why would the behavior be different on the server than on a desktop and how do I fix it.

The code I am using to call XHTMLImporter.convert() is:
/**
* Converts WYSIWYG editor generated HTML
* to XHTML and then to docx
* @param arg_html HTML data to import into docx
*/
private void addHtmlToDocument(String arg_html) {
String parsedData = cleanData(arg_html);
// Convert the XHTML, and add it into the docx we made
XHTMLImporter = new XHTMLImporterImpl(wpMLPkg);

try {
wpMLPkg.getMainDocumentPart().getContent().addAll(XHTMLImporter.convert(parsedData, null));
} catch (Docx4JException de) {
LOGGER.error("DocxGenenerator addHtmlToDocument() failed", de);
}
}

Re: XHTMLImporter.convert() On Server

PostPosted: Thu Feb 18, 2016 6:17 am
by currentg
It looks like the problem was insufficient memory.

I used export JAVA_OPTS="-Xms1024m -Xmx2048m -XX:MaxPermSize=256m" in setenv.sh and the images are now getting processed.