image resource / not found

1

Hi,

I am new to JasperServer and made first Tests.
Jasperserver is running fine, but the Report,
which contains  wood.jpg gives error (wood.jpg missing).

I imported the wood.jpg from Windows Z:\\images\\wood.jpg.
and named the resource wood

- does the recource-name must be the same as the filename ? (wood.jpg instead of wood?)
- Is this a real Upload of the JPG ?
- Where do I find the uploaded files in Unix-Filesystem ?
      or is it imported in the SQL-database

Yours Bernhard

 

 

gramberg's picture
Joined: Mar 8 2010 - 11:13pm
Last seen: 8 years 1 month ago

10 Answers:

0

> - does the recource-name must be the same as the filename ? (wood.jpg instead of wood?)

Yes, you need to specify the exact file name, including the file extension.

> - Is this a real Upload of the JPG ?

I'm not sure how you mean "real" but I think the answer is "yes."

> - Where do I find the uploaded files in Unix-Filesystem ?
>      or is it imported in the SQL-database

The file is stored in the RDBMS that you specified during installation.

Thanks,

Kristen

kkelleher's picture
123
Joined: Jul 19 2006 - 4:59am
Last seen: 4 months 3 weeks ago
0

HI,

real upload means: copy the file-data into the RDBMS.
I have an wood.jpg-image now, but get the following error message.

Any Idea, what must the changed ?




com.jaspersoft.jasperserver.api.JSExceptionWrapper: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : wood.jpg
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:193)



Post Edited by gramberg at 06/14/2010 21:51
gramberg's picture
Joined: Mar 8 2010 - 11:13pm
Last seen: 8 years 1 month ago
0
Hi,

I changed the value from wood.jpg to "wood.jpg".
This changes the error message, but still gives an error.



com.jaspersoft.jasperserver.api.JSExceptionWrapper: net.sf.jasperreports.engine.JRException: Byte data not found at location : wood.jpg
at net.sf.jasperreports.engine.util.JRLoader.loadBytesFromLocation(JRLoader.java:470)
at net.sf.jasperreports.engine.JRImageRenderer.getInstance(JRImageRenderer.java:176)
at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:944)
gramberg's picture
Joined: Mar 8 2010 - 11:13pm
Last seen: 8 years 1 month ago
0


In the JRXML ,

- using the report wizard , you can add the resource -> by clicking -> Add Resources and selecting the image. this will ad dthe image resource with proper prefix ..e.g. if the image is saved under -> /oragnization_1/Image , you need to have that prefix in teh JRXML

 

- If you are using report wizard to do it, it will be done automatically , you may not need to edit the JRXML by hand .

Ramnik Kaur

Senior QA Engineer

ramnik's picture
311
Joined: Mar 16 2007 - 9:10am
Last seen: 11 years 1 month ago
0
Hi,

thank you for the fast answer.

I think, mny problem is, that I work in two worlds (Windows + Unix).
I prepare the Report with the wizard at Windows and get filename like c:\\images\\wood.jpg. So teh filke is stored in the Windows file-System

My JasperServer is running ob my Linux-System. I imported the JRXML. Where the "wrong" filename is located. Because on the Linux-System, there is no C:\\.

But I will try now to edit the JRXML-File and use /image/wood.jpg.
This /image seems to be the logical place, where the file is.

------------------
So the main question is: how are JPGs handeled easy, if I create
the Report within Windows and transfer it to the linux-Jasperserver
wihout editing the JRXML:


Yours Bernhard

gramberg's picture
Joined: Mar 8 2010 - 11:13pm
Last seen: 8 years 1 month ago
0
I chnged the position,
still not working.

com.jaspersoft.jasperserver.api.JSExceptionWrapper: Byte data not found at location : /images/wood.jpg

com.jaspersoft.jasperserver.api.JSExceptionWrapper: net.sf.jasperreports.engine.JRException: Byte data not found at location : /images/wood.jpg
at net.sf.jasperreports.engine.util.JRLoader.loadBytesFromLocation(JRLoader.java:470)
at net.sf.jasperreports.engine.JRImageRenderer.getInstance(JRImageRenderer.java:176)
at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:944)
gramberg's picture
Joined: Mar 8 2010 - 11:13pm
Last seen: 8 years 1 month ago
0

To reference repository resources, you'll need to use repo:.. URIs.  For instance, if you uploaded the image as a reource named "wood" under the "images" folder, you would use repo:/images/wood as image expression in the report.

Regards,

Lucian

lucianc's picture
6818
Joined: Jul 17 2006 - 1:10am
Last seen: 3 hours 7 min ago
0

 Hello

I am in the same situation - I developp the reports using iReports on a Windows machine, and want to execute them on a unix box, with jasperserver.

I've succesfully managed to upload the report, and display graphics, by either specifying a full path for the image, like "/tmp/image.jpg" or a repo link ("repo:/Reports/image.jpg"). However, with this path, the reports doesnt work any longer on Windows Ireport.

How can I have one unique link, working for unix and windows - alternatively, when I specify a path (like the /tmp/imagE.jpg), in which directory does jasperserver looks for ? I could then load the images with no absolute path, and that would do the trick,

 

I am actually quite happy using iReports, it is a great tool.

thanks for the help, 

 

J.

 

cerien's picture
-4
Joined: Jul 28 2010 - 7:48pm
Last seen: 3 months 1 week ago
2

ok... I did a bit of err & try, and can answer this !

Here is how I got it working
a) create the report on the windows box, stating the resource name "image.jpg" - no path
b) have the image stored in the same dir as the report (jrxml)
c) upload the report to the unix box
d) copy "image.jpg" to /opt/jasperserver-ce-3.7.1/apache-tomcat/webapps/jasperserver/WEB-INF/classes
you may need to adapt the beginning of the path depending on your install

and it works - same jrxml on the windows and unix box ! Not sure if it is the academic way... but it is good for me !

J.



Post Edited by cerien at 03/23/2011 18:07
cerien's picture
-4
Joined: Jul 28 2010 - 7:48pm
Last seen: 3 months 1 week ago

Dude, your solution works for me i think the same with you, this is not the most academic solution...BUT!!!...it works

jaime.pegueroles - 4 years 1 month ago
1

The way I do this is to deploy an app with all my images to the app server along with jasperserver, so for instance on Tomcat I create a directory under webapps call ImageStore. Then in my jrxml I use a propery to get to the app.

ImageDir= "http://xxx.com:8080/ImageStore"

I then use:

       Logo=$P{ImageDir} +"/myLogo.png"

As the property name for the actual image resource.

This assumes that the machine you are working on has access to the app server. If not I also have a property for file being local:

    LocalImageDir = "/usr/user1/reports/Images"

    Logo=$P{LocalImageDir} +"/myLogo.png"

This works fine for me, it is probably better ro have the atual data in the db, but it was a apin for me to get it working nicely with iReport and deployed version correctly.

 

brooneyx1's picture
129
Joined: May 4 2009 - 6:10pm
Last seen: 5 days 6 hours ago
Feedback
randomness