Where jasper report should find the report images ...(it looks like OSGi change the classpath behavior)

1,688 views
Skip to first unread message

Pedro Rozo

unread,
Aug 19, 2013, 10:18:37 PM8/19/13
to idem...@googlegroups.com
Hi 

Following a recent Hensin suggestion  I have managed the basic migration of our existent SmartPOS jasper reports (from Adempeire 3.6.1 to idempiere 1.0c report engine), that works if the report doesn´t have images so far ...but if we use an image (jpg or similar)  jasper fires an exception, 

19/08/2013 09:13:35 PM org.compiere.report.ReportStarter startProcess0
SEVERE: ReportStarter.startProcess: Can not run report - Byte data not found at : SmartERP_p.jpg


It looks like it can not find the image files though.all of them are located in the same directory of the .jasper file,with exactly the same name and syntax including capitalization an so on ... (please have in mind same report  with those images used to work in adempeire 3.6.1)

Example:


Filename:  SmartERP_p.jpg
jasper report definition:

                        <image>
<reportElement x="16" y="10" width="242" height="60"/>
<imageExpression class="java.lang.String"><![CDATA["SmartERP_p.jpg"]]></imageExpression>
</image>

So I am wondering if we need to publish the reports folder of idempiere as a classpath location of similar within a OSGi plugin/fragment , so jasper report can find the images ...any other configuration change so jasper can find these images in the classpath ?

Regards,


Pedro Rozo
 

Heng Sin Low

unread,
Aug 20, 2013, 4:30:15 AM8/20/13
to idem...@googlegroups.com
Hi Pedro,

How do you deploy your report ? For attachment, I think it is missing the code to download other resources that you have attached ( should be a straightforward bug to fix though ). For the fragment approach, you would have to use the http://localhost:[port]/imagefile approach. For others, you can try using {RESOURCE_DIR}.

Regards,
Low


--
You received this message because you are subscribed to the Google Groups "iDempiere" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idempiere+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Pedro Rozo

unread,
Aug 20, 2013, 6:28:30 AM8/20/13
to idem...@googlegroups.com
Hi Hengsin

Those are precisely my questions, what are the best practices (if those changed with OSGi) to deploy a simple report (I didn´t find it in the wiki or the previous forum topics).. 

1 Our current deployment approach (similar to adempiere) we just copied the .jasper file under /reports with the required images on the same folder ..   and the jasper URL is: <imageExpression class="java.lang.String"><![CDATA["SmartERP_p.jpg"]]></imageExpression>  (is this still a valid approach/deployment scenario) ?

I didn´t fully understand your suggestion: " For attachment, I think it is missing the code to download other resources that you have attached ( should be a straightforward bug to fix though )." could you elaborate it a bit more ? (my resources: report and images are in the same /report folder ...  for example  what would be the sintaxo for this case:  <imageExpression class="java.lang.String"><![CDATA["SmartERP_p.jpg"]]></imageExpression>   .  {RESOURCE_DIR}.  

2. What would be  the best approach with OSGi so the jasper reports can get access to those server images ?

If I understood correctly, for the fragment approach, I would have to use something like this ?
 <imageExpression class="java.lang.String"><![CDATA["http://localhost:8080/webui/reports/SmartERP_p.jpg"]]></imageExpression>

I would appreciate if you can show us  a simple example of those image URL´s for these two scenarios to be more precise ..

Regards.

Pedro Rozo..

Heng Sin Low

unread,
Aug 20, 2013, 8:07:11 AM8/20/13
to idem...@googlegroups.com
Hi Pedro,

The /reports approach should still work as it is, I'm surprise that doesn't work for you.

For the fragment approach, yes, it needs URL but the path should be  http://localhost:8080/JasperReportFiles/SmartERP_p.jpg . There is a thread on this earlier, see https://groups.google.com/d/msg/idempiere/YXZVLT9GX1c/Z4crJUlOpPwJ . I guess instead of required hardcoding of the url path, the ReportStarter should that (  http://localhost:8080/JasperReportFiles ) as parameter instead.

Regards,
Low
Reply all
Reply to author
Forward
0 new messages