Jump to content
Changes to the Jaspersoft community edition download ×

Unable to get images to work in JasperReports


shanff

Recommended Posts

I've created  a report in iReport 3.1.4 and uploaded the .jrxml file to JasperReports 3.1.4 server via it's web interface.  I included an image file using the syntax "repo:/images/logo.gif" and verified that it was set in the .jrxml file correctly.  When I run the report from the JasperReports WebGUI, I get the report, with the data I would expect in the correct places, but no image.  There looks to be a "frame" where the image should be when the data is loading, but no image shows up.

If I run the report in iReport and set up the repository, I can drag the image to the report and see the correct image on the report at design time, but when I run the report, it dumps out:

"Error filling print...Byte data not found at location : repo:/images/logo.gif

net.sf.jasperreports.engine.JRException: Byte data not foundat location : repo:/images/logo.gif

at net.sf.jasperreports.engine.util.JRLoader.loadBytesFromLocation(JRLoader.java:486) ......

 

If I use a local (to the computer iReport is running on) image, iReport works great. 

How can I get this image to show up correctly from JasperReport WebGUI? 

 

JasperReport and iReport 3.1.4, JasperReports is the single download with bundled Tomcat/Apache/MySQL

 

 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

I don't use the jasperserver but I'm sure this will still work, I use java.io.InputStream for the image Class and use;

ClassLoader.getSystemResourceAsStream("com/blah/images/icon.gif")

in the Image Expression to load the image. So all you have to do is include the image in your classpath, it can even be in a jar file.

Hope this helps.

munga

Link to comment
Share on other sites

Thanks for the suggestion,but I'm unable to get this code to bring up the image either. The weird thing is that I can get the report to run correctly a number of ways that always show the frame where the image should be located, but never show the image. No errors are produced indicating a problem, so I assume that the image is being found. Also, when the report actually completes, it "exports" 214 copies of the report. The initial report displays 214 copies that I can scroll down and see as well as exports to .xls and .csv 214 copies. I'm at a loss as to why it's acting this way. I've done a bundled tomcat package from sourceforge and a Bitnami stack, both are acting the same. I've got openjdk 1.6.0 installed on a very clean minimal Centos 5.2 install. Everything else "seems" to work. Any other suggestions would be welcomed. Thanks
Link to comment
Share on other sites

  • 1 year later...

Even i am facing the same issue of image not getting displayed in html view whereas i can see the images if i export to pdf file.....please help me with this.....Thanks

Code:
In jrxml:<imageExpression class="java.lang.String"><![CDATA["icons/logo.gif"]]></imageExpression>In Java file :htmlExporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,"");
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...