Image Servlet Not Rendering


I've created a portlet using Liferay.  I believe I have this set correctly but I can not get the images to display.  I'm new to Java so I'm trying to determine the best way to debug this.  My code is here:

                JRHtmlExporter exporter = new JRHtmlExporter();
		exporter.setParameter(JRExporterParameter.JASPER_PRINT, printObject);
		exporter.setParameter(JRExporterParameter.OUTPUT_STRING_BUFFER,	outputBuffer);
		exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, new HashMap());
		exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "../servlets/image?image=");
		exporter.setParameter(JRHtmlExporterParameter.IS_WHITE_PAGE_BACKGROUND, java.lang.Boolean.FALSE);
		exporter.setParameter(JRHtmlExporterParameter.IGNORE_PAGE_MARGINS, java.lang.Boolean.TRUE);
And I have this code in my web.xml
Everywhere I read makes me believe I have this right, but I am getting nothing in the HTML version.  The PDF and XLS versions of the reports all show the graphics and graphs.  Any clues on how to debug this or troubleshoot this and track it down?
gstafford's picture
Joined: Oct 9 2012 - 2:18pm
Last seen: 10 years 2 months ago

2 Answers:


request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "image?image=");

see for example

sanbez's picture
Joined: Jan 11 2011 - 2:06am
Last seen: 2 years 5 months ago

So I made the adjustments you recommended - I apologize for taking so long, busy week. When I do this the code in the browser renders as http://xxxxxxx/group/guest/image?image=px which returns a 404. I've adjusted the link several different ways including http://xxxxxx/image?image=px and I get a 404 with all of them. Any other thoughts?

gstafford - 10 years 2 months ago

I am not sure I get your image displaying issue in the right way, but I think you can read this blog, most of it talking about the imaging issue in liferay.smiley

amywhite989's picture
Joined: Feb 7 2014 - 6:25pm
Last seen: 8 years 10 months ago