I am getting the HeadlessException when converting an image from XHTML to docx.
I found this (docx-java-f6/problem-to-create-word-s-file-with-images-on-linux-server-t322.html#p967) which says to use a more updated version of xmlgraphics-commons.jar. That was in 2010. I downloaded docx4j a couple of days ago and have xmlgraphics-commons-1.4.jar from 30-Sep-2012.
I also found this (http://stackoverflow.com/questions/1156 ... hat-server) which says there is an update in flyingsaucer that fixes this issue. I downloaded their version of the xhtmlrender jar file which is not compatible with xhtmlrenderer-1.0.0.jar which uses a different package structure. How can I update ImageUtil.java in xhtmlrenderer-1.0.0.jar and build it to try it?
I am using -Djava.awt.headless=true when running my application.
Anyone?
java.awt.HeadlessException
at sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:64)
at org.docx4j.org.xhtmlrenderer.util.ImageUtil.getGraphicsConfiguration(ImageUtil.java:119)
at org.docx4j.org.xhtmlrenderer.util.ImageUtil.makeCompatible(ImageUtil.java:70)
at org.docx4j.org.xhtmlrenderer.swing.AWTFSImage.createImage(AWTFSImage.java:38)
at org.docx4j.org.xhtmlrenderer.swing.NaiveUserAgent.createImageResource(NaiveUserAgent.java:197)
at org.docx4j.org.xhtmlrenderer.swing.NaiveUserAgent.getImageResource(NaiveUserAgent.java:167)
at org.docx4j.org.xhtmlrenderer.docx.Docx4jReplacedElementFactory.createReplacedElement(Docx4jReplacedElementFactory.java:57)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.calcDimensions(BlockBox.java:677)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.calcDimensions(BlockBox.java:631)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:778)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:735)
at org.docx4j.org.xhtmlrenderer.layout.InlineBoxing.layoutInlineBlockContent(InlineBoxing.java:203)
at org.docx4j.org.xhtmlrenderer.layout.InlineBoxing.layoutContent(InlineBoxing.java:165)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layoutInlineChildren(BlockBox.java:964)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:943)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:818)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:735)
at org.docx4j.org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:61)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:947)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:818)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:735)
at org.docx4j.org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:61)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:947)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:818)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:735)
at org.docx4j.org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:61)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:947)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:818)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:735)
at org.docx4j.org.xhtmlrenderer.docx.DocxRenderer.layout(DocxRenderer.java:187)
at org.docx4j.convert.in.xhtml.XHTMLImporter.convert(XHTMLImporter.java:312)
at com.desertsky.ldrd.shared.report.DOCXWrapper.responseAsDocx(DOCXWrapper.java:136)
at com.desertsky.ldrd.shared.report.DOCXWrapper.appendToResponse(DOCXWrapper.java:68)
at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1122)
at com.webobjects.appserver._private.WOComponentReference.appendToResponse(WOComponentReference.java:135)
at com.webobjects.appserver._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:126)
at com.webobjects.appserver._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1122)
at com.desertsky.ldrd.shared.report.DOCXReportPage.appendToResponse(DOCXReportPage.java:42)
at com.desertsky.ldrd.shared.report.proposal.ProposalSummaryDOCXReport.appendToResponse(ProposalSummaryDOCXReport.java:56)
at com.webobjects.appserver.WOSession.appendToResponse(WOSession.java:1385)
at er.extensions.appserver.ERXSession.appendToResponse(ERXSession.java:571)
at com.desertsky.ldrd.shared.foundation.LDRDSession.appendToResponse(LDRDSession.java:62)
at com.webobjects.appserver.WOApplication.appendToResponse(WOApplication.java:1794)
at er.extensions.appserver.ERXApplication.appendToResponse(ERXApplication.java:2005)
at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedPage(ERXComponentRequestHandler.java:190)
at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedSession(ERXComponentRequestHandler.java:235)
at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedApplication(ERXComponentRequestHandler.java:268)
at er.extensions.appserver.ERXComponentRequestHandler._handleRequest(ERXComponentRequestHandler.java:302)
at er.extensions.appserver.ERXComponentRequestHandler.handleRequest(ERXComponentRequestHandler.java:374)
at com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1687)
at er.extensions.appserver.ERXApplication.dispatchRequestImmediately(ERXApplication.java:2109)
at er.extensions.appserver.ERXApplication.dispatchRequest(ERXApplication.java:2074)
at com.desertsky.ldrd.shared.foundation.LDRDApplication.dispatchRequest(LDRDApplication.java:410)
at com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:144)
at com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:226)
at java.lang.Thread.run(Thread.java:680)