I am currently using a JasperServer
re开发者_开发技巧pository to hold reports. I would like to include an image of a logo in the upper-right hand corner of the report. However, every time I attempt to add an image to the resources I get an error that says:
Error:
1 - 0
Any guesses?
This is how I did it:
- Create a report on Ireport with a picture on it (e.g. logo.jpg)
- Edit the .jrxml file using a text editor.
- Search for the image file name. You will find the file name (with full path) in a cdata tag
- Change it to
<![CDATA["repo:logo.jpg"]]>
- Save and Upload the report to the JasperServer
- Edit the report and choose Controls & Resources.
- Add a resource, select the image file (e.g. logo.jpg) and name it exactly as logo.jpg.
- Submit and... run... the report :) When you open the file again on iReport, it will only show an image generic icon...
The most likely reason for the error that you are seeing is that there's a problem with the web services configuration. The most likely problem is that the image is greater than 16Kb, so Axis needs to save the attachment to a temporary directory. A useful test is to make sure that images smaller than 16Kb work with no problems.
Your quickest workaround is to upload the picture via the JasperServer web UI. Then your report should work as expected. If so, it's also validation that the problem is with web services (not with the repository database or some other component).
The most likely permanent solution is to recursively change ownership of the directory .../webapps/jasperserver/
. Or you might prefer to only chown .../webapps/jasperserver/WEB-INF/attachments
. Or you could change the attachments directory by editing this line in server-config.wsdd:
<parameter name="attachments.Directory" value="attachments"/>
精彩评论