TIBCOSoftware / jasperreports

JasperReports® - Free Java Reporting Library
https://community.jaspersoft.com/downloads/community-edition/
GNU Lesser General Public License v3.0
1.07k stars 404 forks source link

Jasper 7 template migration #460

Closed SATISHEEEK closed 4 months ago

SATISHEEEK commented 4 months ago

Dear jasperreports devs, I am having a following issues while migrating our reports to jasper 7.

1) Class Imports (that worked fine in jasper 6) not working anymore:

 [ERROR] Could not compile testReport.jrxml because Errors were encountered when compiling report expressions class file:
C:\Workspace\SG2020\testModule\testReport_199beaf6a46c327cdfe51ed925659331892432751877601c9c70547cf95ac60a.java:13: error: package ...reports.domain.service.impl does not exist
import ...reports.domain.service.impl.FormatUtil; 

2) Some parameters throw following exception:

  symbol:   class JRFillVariable
  location: class testReport_199beaf6a46c327cdfe51ed925659331892432751877601c9c70547cf95ac60a
C:\Workspace\SG2020\testModule\testReport_199beaf6a46c327cdfe51ed925659331892432751877601c9c70547cf95ac60a.java:39: error: cannot find symbol
    private JRFillVariable variable_REPORT_COUNT = null;

Do you, please, have any idea what could be causing these issues?

Thank you in advance! Jan

teodord commented 4 months ago

Hi,

Add jasperreports-jdt-7.0.0.jar and its dependencies to your application build. Hopefully, you are using Maven build and rely on its dependency management. Without the JDT compiler in the classpath, the JDK compiler is used, but it does not have the classpath configured properly, hence, the errors you are seeing. Furthermore, you are probably aware that unless you have dynamic report templates, you should compile your JRXML files to *.jasper files at application build time and deploy them compiled. You dont need to compile them every time at application run time.

I hope this helps. Teodor

SATISHEEEK commented 4 months ago

Hi @teodord, first of all, thank you for your detailed response. With this dependency I was able to get rid of most errors. As you said we're using JDK compiler and we compile jrxml files once and use only .jasper files on the runtime.

anyway, some of our reports that use tables shows this error ( also shown in jaspersoft studio 7:

Could not resolve subtype of [simple type, class net.sf.jasperreports.components.table.BaseCell]: missing type id property 'kind' (for POJO property 'noData')
 at [Source: (ByteArrayInputStream); line: 445, column: 16] (through reference chain: net.sf.jasperreports.engine.design.JasperDesign["detail"]->net.sf.jasperreports.engine.design.JRDesignSection["band"]->java.util.ArrayList[0]->net.sf.jasperreports.engine.design.JRDesignBand["element"]->java.util.ArrayList[0]->net.sf.jasperreports.engine.design.JRDesignComponentElement["component"]->net.sf.jasperreports.components.table.StandardTable["noData"])

do you have any idea why is that? Thank you in advance!

SATISHEEEK commented 4 months ago

@teodord happens everytime if I add "no data" band to a table.

Thanks!

SATISHEEEK commented 4 months ago

And one more question regarding the Style templates:

We've got following definition in our reports: <template><![CDATA["../resources/Styles.jrtx"]]></template> This allows us to test reports locally.

Once the project is compiled, the structure changes and we use REPORT_TEMPLATES to hand over jrtx file which we want to be used. In jasper 7 we got a following runtime error if the stylesheet is not available. In jasper 6 it was simply ignored and REPORT_TEMPLATES references were used.

Is there any way to ignore the missing file and simply use reference from REPORT_TEMPLATES parameter?

Caused by: net.sf.jasperreports.engine.JRException: Byte data not found at: ../resources/Styles.jrtx. 2024-07-22T22:03:14.363240712Z at net.sf.jasperreports.repo.RepositoryUtil.getBytesFromLocation(RepositoryUtil.java:215) 2024-07-22T22:03:14.363245339Z at net.sf.jasperreports.engine.xml.JRXmlTemplateLoader.loadTemplate(JRXmlTemplateLoader.java:114)

Sorry for having so many questions guys. Thank you so much for your help! @teodord

SATISHEEEK commented 4 months ago

@teodord please, if you get a chance, could you have a look at issues mentioned in the comments?

teodord commented 4 months ago

Please avoid asking different question on a single thread. It makes it difficult to manage such trackers. You already brought up 4 different topics here. Which one are we talking about now? See?...

SATISHEEEK commented 4 months ago

you're right. I'll close this one and create new ones for each of my issues. Sorry.

teodord commented 4 months ago

No need to log the noData issue in table component. It has been fixed here: https://github.com/TIBCOSoftware/jasperreports/commit/3a1cf49e7bc5058362ff81cb94b6ab0643c3e6a7 and a new master branch snapshots has been published here: https://jaspersoft.jfrog.io/ui/native/jr-ce-snapshots/net/sf/jasperreports/jasperreports/master-SNAPSHOT/

Thank you, Teodor