Jump to content
We've recently updated our Privacy Statement, available here ×

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


toonskies

Recommended Posts

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.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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.

 

 

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...