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

HtmlComponent java.lang.NoSuchFieldError: elementId


ale_rockmetal

Recommended Posts

Hi!

I am trying to generate a report from eclipse with HtmlComponent.
In the line "jasperPrint = JasperFillManager.fillReport(jasperReport, parameters,new JRBeanArrayDataSource((Object[]) fields));" returns the following error:

2022-10-26 21:38:40.290 ERROR 5596 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchFieldError: elementId] with root cause

java.lang.NoSuchFieldError: elementId
    at net.sf.jasperreports.components.html.HtmlComponentFill.prepare(HtmlComponentFill.java:119) ~[jasperreports-htmlcomponent-5.0.1.jar:na]
    at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:152) ~[jasperreports-6.19.1.jar:6.19.1-867c00bf88cd4d784d404379d6c05e1b419e8a4c]
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:542) ~[jasperreports-6.19.1.jar:6.19.1-867c00bf88cd4d784d404379d6c05e1b419e8a4c]

...

This is the element I added:

    <componentElement>
        <reportElement x="10" y="203" width="200" height="200" uuid="a225e897-fafb-41a9-8e72-4d2dae895258"/>
        <hc:html xmlns:hc="http://jasperreports.sourceforge.net/htmlcomponent" xsi:schemaLocation="http://jasperreports.sourceforge.net/htmlcomponent http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd" scaleType="RetainShape" horizontalAlign="Left" verticalAlign="Middle">
            <hc:htmlContentExpression><![CDATA["<p>Prueba</p><p><strong>Prueba</strong></p><p><u>Prueba</u></p><h1>PRUEBA H1</h1><h2>PRUEBA H2</h2>"]]></hc:htmlContentExpression>
        </hc:html>
    </componentElement>

When I remove it, the report prints correctly.

I attach the images of the libraries that I am using in the project.

Any idea what I might be missing?

From already thank you very much!


Ale

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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