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

Images won't load when my website invokes jasperserver to generate report


jason.demmery

Recommended Posts

Jasperserver Community Edition (JS) hosted on linux.  Website invokes call using REST, I haven't recoded for SOAP, so I upgraded JS to 5.6.1 from 4.1.0 instead of trying 6.x.x.  Using default installation of JS, which bundles java and postgresql.  JDBC connector in JS calls my MySQL database.  Reports are being generated with data (output to pdf), just the images aren't loading.  When I change the image path to something invalid, catalina.out logfile catches an exception thrown about Byte Data Not Found; otherwise there is no log error at all.  All errors, warnings etc have been set to go to logfile. The jrxml report and subreport were written in TIBCO JS Studio.

Image folder properties says, "/images".  Image property says, "/root/Images/test.jpg"

After invoking from my web portal, an instance of the report appears on the JS host webpage in "Library." I can generate the report from there and it includes the image.  I have also verified the input parameter is passing correctly (displayed on output).  "isLazy" has no effect.  I've found various tips about including a class in the image tag, everything found so far only breaks it further or generates errors specific to the change.  The image tag is simple, thusly: 

   <image>    <reportElement x="350" y="20" width="190" height="50"/>    <imageExpression><![CDATA[new String($P{input_path}+"/images/test.jpg")]]></imageExpression>   </image>[/code]

input_path defaults to "repo:"

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

If the images are part of the report itself (report content resources) you can just reference them by ID in your image expression like "test.jpg". If the image is a repository resource you can use "repo:/path/to/image" syntax to reference the image.

For REST v2 there is a parameter called attachmentsPrefix that you can try using. I am not sure it's present in 5.6.

For HTML output, this property specifies the URL path to use for downloading the attachment files (JavaScript and images). The full path of the default value is:

{contextPath}/rest_v2/reportExecutions/{reportExecutionId}/exports/{exportExecutionId}/attachments/

You can specify a different URL path using the placeholders {contextPath}, {reportExecutionId}, and {exportExecutionId}. The {contextPath} can be also manipulated through deploy.base.url property in js.config.properties file.

If you are to use REST v2 it's generally recommended to use 6.3/6.4 version as it has more ironed out and more feature complete REST web service.

Link to comment
Share on other sites

  • 2 weeks later...

None of the versions available for download work properly.

I found an old installer for 4.1 JasperServer Community, installed that on the new server, and it works just fine.  We would have liked to upgrade, considered purchasing a new version, but what's the point when documentation is sparse and often incorrect or outdated, features removed, API's broken (intentionally?) etc etc etc.  We will be upgrading our reporting service, but since the API is fundamentally different between 4.1 and 6.x, we're just going to go with crystal reports or something else.  Development time will be similar.  Better product support guaranteed.  Honestly, the service was just running defaults, we upload an image to the service, the service produces a PDF with the image from it's :8080 login page.  Calling the report over the API, no image.  Calling the report using 4.1, image embeds in PDF like it's supposed to, both ways. They obviously broke something and left it that way, and nobody seems to know what or why.  We're very jaded now about jasper.  99% of the available help for this product is dated 2008, none of it applies to any of its recent versions since 2012.  Even the "Answers" portion of this website is effectively dead.  0 0 0, 0 1 0, 0 0 0, 0 0 0, 0 0 0.... A dozen questions a day, one maybe gets answered in a non-helpful way.  Your product is dying.

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