#1 2021-02-23 23:46:21

telpochyaotl
Member
Registered: 2021-02-17

issues compiling JRXML with SVG images.

Hello All, If my JRXML has SVG Images, I'm getting the error below.

I've tried a number of ways to define the SGV images down to a version of JasperReports way below 6.9.0 (the version shipped with Report server) (as low as tested with JR 5.2). But the old JRXML and the new JRXML end up giving me the same error shown below:

I have not tried upgrading any JAR in ReportServer ...

Anyone has a JRXML with SVG that works in latest RS?

How possible/impossible is it to upgrade JR libraries in RS? Where can I find a list of all that I would need to? I only see jasperreports-6.9.0.jar and jasperreports-fonts-6.9.0.jar) but don't know what other dependencies are added because of JR

Thanks a lot in advance!

Here is the error:

-----------------------------------------
Type Exception Report

Message Filter execution threw an exception

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Filter execution threw an exception
Root Cause

java.lang.NoClassDefFoundError: org/apache/batik/bridge/FontFamilyResolver
    net.sf.jasperreports.renderers.util.SvgDataSniffer.<init>(SvgDataSniffer.java:57)
    net.sf.jasperreports.renderers.util.SvgDataSniffer.getInstance(SvgDataSniffer.java:68)
    net.sf.jasperreports.renderers.util.RendererUtil.getSvgDataSniffer(RendererUtil.java:164)
    net.sf.jasperreports.renderers.util.RendererUtil.getSvgInfo(RendererUtil.java:133)
    net.sf.jasperreports.renderers.util.RendererUtil.isSvgData(RendererUtil.java:114)
    net.sf.jasperreports.renderers.util.RendererUtil.isSvgData(RendererUtil.java:153)
    net.sf.jasperreports.engine.export.JRPdfExporter$InternalImageProcessor.process(JRPdfExporter.java:1587)
    net.sf.jasperreports.engine.export.JRPdfExporter$InternalImageProcessor.access$300(JRPdfExporter.java:1542)
    net.sf.jasperreports.engine.export.JRPdfExporter.exportImage(JRPdfExporter.java:1482)
    net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:1100)
    net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:1063)
    net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:927)
    net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:547)
    net.datenwerke.rs.base.service.reportengines.jasper.output.generator.JasperPDFOutputGenerator.exportReport(JasperPDFOutputGenerator.java:60)
    net.datenwerke.rs.base.service.reportengines.jasper.JasperReportEngine.executeReport(JasperReportEngine.java:302)
    net.datenwerke.rs.base.service.reportengines.jasper.JasperReportEngine.doExecute(JasperReportEngine.java:110)
    net.datenwerke.rs.core.service.reportmanager.engine.ReportEngine.execute(ReportEngine.java:143)
    net.datenwerke.rs.core.service.reportmanager.ReportExecutorServiceImpl.execute(ReportExecutorServiceImpl.java:211)
    net.datenwerke.rs.core.service.reportmanager.ReportExecutorServiceImpl.execute(ReportExecutorServiceImpl.java:144)
    net.datenwerke.rs.core.server.reportexport.ReportExportServlet.executeReport(ReportExportServlet.java:557)
    net.datenwerke.rs.core.server.reportexport.ReportExportServlet.doExportReport(ReportExportServlet.java:438)
    net.datenwerke.rs.core.server.reportexport.ReportExportServlet.exportReport(ReportExportServlet.java:368)
    net.datenwerke.rs.core.server.reportexport.ReportExportServlet.exportReportById(ReportExportServlet.java:294)
    net.datenwerke.rs.core.server.reportexport.ReportExportServlet.exportReportByIdViaRequest(ReportExportServlet.java:285)
    net.datenwerke.rs.core.server.reportexport.ReportExportServlet.doGet(ReportExportServlet.java:169)
    net.datenwerke.rs.incubator.server.httpauthexecute.HttpAuthExecuteServlet.doGet(HttpAuthExecuteServlet.java:83)
    com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:64)
    net.datenwerke.security.service.security.aop.SecurityCheckInterceptor.invoke(SecurityCheckInterceptor.java:109)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
    net.datenwerke.security.service.security.aop.SecurityCheckInterceptor.invoke(SecurityCheckInterceptor.java:109)
    com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:290)
    com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:280)
    com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:184)
    com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:89)
    com.google.inject.persist.PersistFilter.doFilter(PersistFilter.java:94)
    com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:121)
    com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)
Root Cause

java.lang.ClassNotFoundException: org.apache.batik.bridge.FontFamilyResolver
    org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
    org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
    net.sf.jasperreports.renderers.util.SvgDataSniffer.<init>(SvgDataSniffer.java:57)
    net.sf.jasperreports.renderers.util.SvgDataSniffer.getInstance(SvgDataSniffer.java:68)
    net.sf.jasperreports.renderers.util.RendererUtil.getSvgDataSniffer(RendererUtil.java:164)
    net.sf.jasperreports.renderers.util.RendererUtil.getSvgInfo(RendererUtil.java:133)
    net.sf.jasperreports.renderers.util.RendererUtil.isSvgData(RendererUtil.java:114)
    net.sf.jasperreports.renderers.util.RendererUtil.isSvgData(RendererUtil.java:153)
    net.sf.jasperreports.engine.export.JRPdfExporter$InternalImageProcessor.process(JRPdfExporter.java:1587)
    net.sf.jasperreports.engine.export.JRPdfExporter$InternalImageProcessor.access$300(JRPdfExporter.java:1542)
    net.sf.jasperreports.engine.export.JRPdfExporter.exportImage(JRPdfExporter.java:1482)
    net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:1100)
    net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:1063)
    net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:927)
    net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:547)
    net.datenwerke.rs.base.service.reportengines.jasper.output.generator.JasperPDFOutputGenerator.exportReport(JasperPDFOutputGenerator.java:60)
    net.datenwerke.rs.base.service.reportengines.jasper.JasperReportEngine.executeReport(JasperReportEngine.java:302)
    net.datenwerke.rs.base.service.reportengines.jasper.JasperReportEngine.doExecute(JasperReportEngine.java:110)
    net.datenwerke.rs.core.service.reportmanager.engine.ReportEngine.execute(ReportEngine.java:143)
    net.datenwerke.rs.core.service.reportmanager.ReportExecutorServiceImpl.execute(ReportExecutorServiceImpl.java:211)
    net.datenwerke.rs.core.service.reportmanager.ReportExecutorServiceImpl.execute(ReportExecutorServiceImpl.java:144)
    net.datenwerke.rs.core.server.reportexport.ReportExportServlet.executeReport(ReportExportServlet.java:557)
    net.datenwerke.rs.core.server.reportexport.ReportExportServlet.doExportReport(ReportExportServlet.java:438)
    net.datenwerke.rs.core.server.reportexport.ReportExportServlet.exportReport(ReportExportServlet.java:368)
    net.datenwerke.rs.core.server.reportexport.ReportExportServlet.exportReportById(ReportExportServlet.java:294)
    net.datenwerke.rs.core.server.reportexport.ReportExportServlet.exportReportByIdViaRequest(ReportExportServlet.java:285)
    net.datenwerke.rs.core.server.reportexport.ReportExportServlet.doGet(ReportExportServlet.java:169)
    net.datenwerke.rs.incubator.server.httpauthexecute.HttpAuthExecuteServlet.doGet(HttpAuthExecuteServlet.java:83)
    com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:64)
    net.datenwerke.security.service.security.aop.SecurityCheckInterceptor.invoke(SecurityCheckInterceptor.java:109)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
    net.datenwerke.security.service.security.aop.SecurityCheckInterceptor.invoke(SecurityCheckInterceptor.java:109)
    com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:290)
    com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:280)
    com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:184)
    com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:89)
    com.google.inject.persist.PersistFilter.doFilter(PersistFilter.java:94)
    com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:121)
    com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)

Offline

#2 2021-02-24 09:54:17

eduardo
Administrator
Registered: 2016-11-01
Website

Re: issues compiling JRXML with SVG images.

Hi telpochyaotl,

I did not understand, are you trying to downgrade or to upgrade the jasper library?

Regards,
Eduardo

Offline

#3 2021-02-24 16:20:00

telpochyaotl
Member
Registered: 2021-02-17

Re: issues compiling JRXML with SVG images.

Hi Eduardo!

I'm honestly trying to produce a PDF that has SVG images, but I get the error pasted above.  I should have been more clear. A happy solution would be that I can make such a PDF....  If someone is currently capable of rendering a PDF with SVG in RS, please share your XML smile

In the mean time, because I have the error above, I suspect RS is missing a dependency (ava.lang.NoClassDefFoundError: org/apache/batik/bridge/FontFamilyResolver) or there is some other JAR conflict. I have yet to research if the Batik version in RS has this class or not.

Then I would have to figure out how to fix that dependency issue. I don't know if it is Batik or JasperReport related.   In either case I think it would need to be adding  JAR(s) or Upgrading JAR(s).

Thank you so much again for your kind and quick responses!

Offline

#4 2021-02-25 08:29:49

eduardo
Administrator
Registered: 2016-11-01
Website

Re: issues compiling JRXML with SVG images.

Hi telpochyaotl,

do you have a jasper that is working on the jasper environment ( you get a correct preview for it in the jasper IDE ) , but that does not work in a current version of ReportServer?

Regards,
Eduardo

Offline

#5 2021-02-25 19:48:07

telpochyaotl
Member
Registered: 2021-02-17

Re: issues compiling JRXML with SVG images.

Hello Eduardo!

Yes I do, i quickly made the following JRXML, it has a parameter (circlesUrl) that if you fill it up with say a PNG, it will render fine and display the image both in JR Studio and RS, but if you fill it up with an SVG, it works in JR studio and crashes in RS with the error above.

I hope this helps!

I have not done any further research but will try to see if the class not found is indeed or not in the available JARs and if not if adding it from an available version, fixes the issue.

(ps: i don't see how to attach the JRXML or images, i'll paste the JRXML in the next post.

Offline

#6 2021-02-25 19:55:00

telpochyaotl
Member
Registered: 2021-02-17

Re: issues compiling JRXML with SVG images.

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ZosiCompletionCertificate" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="5125b78b-8609-4065-8bba-c9e75b823244">
    <property name="net.sf.jasperreports.image.dpi" value="200"/>
    <style name="Style1" isDefault="true"/>
  <parameter name="circlesUrl" class="java.lang.String"/>
    <queryString>
        <![CDATA[select now() as hoy]]>
    </queryString>
    <field name="hoy" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="certificate_id"/>
        <property name="com.jaspersoft.studio.field.label" value="certificate_id"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="certificates"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <detail>
        <band height="555">
            <property name="com.jaspersoft.studio.unit.height" value="px"/>
            <textField>
                <reportElement x="40" y="310" width="440" height="60" forecolor="#21B6D7" uuid="42efac3c-fdff-432d-a68b-69925cebd01b">
                    <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="62b2ea74-7673-4e37-9e27-a7c0897fc8e5"/>
                </reportElement>
                <textElement>
                    <font size="22"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{hoy}]]></textFieldExpression>
            </textField>
            <image>
                <reportElement x="410" y="90" width="360" height="360" uuid="39178787-abe4-4c4c-9dc6-7b4e31a43736"/>
                <imageExpression><![CDATA[$P{circlesUrl}]]></imageExpression>
            </image>
        </band>
    </detail>
</jasperReport>

Offline

#7 2021-02-25 21:06:38

telpochyaotl
Member
Registered: 2021-02-17

Re: issues compiling JRXML with SVG images.

Ok, I've done just a bit of research.

RS = ReportServer
JR = JasperReports

- RS 3.4 has JR 6.9.0
- RS 3.4 has batik 1.7
- JR 6.9.0 needs batik 1.11
- batik 1.7 does NOT have org.apache.batik.bridge.FontFamilyResolver
- batik 1.11 does have it

So it seems like if we're using JR 6.9.0 in RS, we should use the same dependency versions that JR has....

I have not tried simply replacing all the batik 1.7 jars.... I did try batik-bridge and it did make a difference. But now more dependencies need upgrading.

I don't know the implications of replacing all batik jars I don't know what other things depend on batik 1.7 for example. But having the same  dependencies needed by JR makes sense.

Hope this helps.

Last edited by telpochyaotl (2021-02-25 21:07:58)

Offline

#8 2021-02-26 10:53:43

eduardo
Administrator
Registered: 2016-11-01
Website

Re: issues compiling JRXML with SVG images.

Hi telpochyaotl,

thanks for your research on this. You are right, we raised ticket RS-4729 for investigating these dependencies.

Regards,
Eduardo

Offline

#9 2021-02-26 14:43:32

telpochyaotl
Member
Registered: 2021-02-17

Re: issues compiling JRXML with SVG images.

Thank you Eduardo.

If you have a good testing suite that could be used to verify that things are OK when replacing those batik JARs with newer versions please let me know.

Otherwise, for now we'll just use PNGs

Thank you so much again for your attention and for a great product ReportServer is!

Offline

#10 2022-04-27 10:40:51

eduardo
Administrator
Registered: 2016-11-01
Website

Re: issues compiling JRXML with SVG images.

Hi telpochyaotl,

pls note that we upgraded batik to 1.14 which is required by jasperreports 6.19.1. If you upgrade to the latest ReportServer version (currently 4.1.0) this should work.

Regards,
Eduardo

Offline

#11 2022-04-27 14:30:20

telpochyaotl
Member
Registered: 2021-02-17

Re: issues compiling JRXML with SVG images.

Thank you so much for this Eduardo! I will make a plan to upgrade now smile Take care!

Offline

Board footer

Powered by FluxBB