Error opening input stream from URL : repo:/images/coffee.jpg

0

Any help greatly appreciated for the following error message I'm getting regarding my uploaded report in JasperReports Server not being able to open associated image.

I get the following error message after clicking on my report:

 

----------------------------------------------------------------------

Error Message

net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error opening input stream from URL : repo:/images/coffee.jpg

Error Trace

net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error opening input stream from URL : repo:/images/coffee.jpg at net.sf.jasperreports.repo.DefaultRepositoryService.getInputStream(DefaultRepositoryService.java:138) at net.sf.jasperreports.repo.RepositoryUtil.findInputStream(RepositoryUtil.java:186) at net.sf.jasperreports.repo.RepositoryUtil.getBytes(RepositoryUtil.java:202) at net.sf.jasperreports.engine.JRImageRenderer.getInstance(JRImageRenderer.java:141) at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:498) at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:441) at (etc etc...)

----------------------------------------------------------------------

The image is in the images folder and i've added the image as a resource within the report, so I don't know what else (if anything) I need to do.

toonskies's picture
Joined: Mar 22 2012 - 2:07am
Last seen: 7 years 8 months ago

2 Answers:

0

I am getting the same error message but in my case its with a sub report.  I have added the sub report as Resource to my main report..... how to resolve this ....   help Pls.....

meeza4u's picture
12
Joined: Apr 3 2012 - 7:23am
Last seen: 6 years 8 months ago
0

I actually solved this issue.

When you import the .jrxml file into JasperReports Server, it doesn't add resources such as images etc. so you have to add them individually as resources. i.e.: when adding a jasper report as a resource, click the 'controls and resources' button and then in the 'Controls and resources' screen, you add your required resources, be they images, or sub report, basically anything your report (.jrxml file) needs.

what i did was I added my image into the image folder, gave it a name, a resource id (the resource id is what the .jrxml file needs to reference in it's code.

i.e. The .jrxml file is basically an xml file. the line in my xml was like this when it came from iReport:

<imageExpression><![CDATA["coffee.jpg"]]></imageExpression>

So seeing as the iReport doesn't bring resources with it on importation, there was no coffee.jpg to be found, so I first added it as an image resource in the main 'images' folder, then I had to change that line of xml to be the following:

<imageExpression><![CDATA["repo:/images/coffee_bean"]]></imageExpression>

Keep in mind that "coffee_bean" is actually the resource id of the image, so that get referenced, not the actual file name of the resource(image).

So I'm guessing that in your case, you would add the sub report as a resource, take note of the resource id, then change the relative line of xml code accordingly. Hope that works for you or at least sets you on the right track.

 

 

toonskies's picture
Joined: Mar 22 2012 - 2:07am
Last seen: 7 years 8 months ago
Feedback
randomness