How to create a QR Code in JasperSoft Studio? - jaspersoft-studio

I'm trying to create a QR code in JasperSoft Studio.
We have a report properly working on production containing a QR code. But after a new installation of JasperSoft Studio, we are unable to run the report.
While compiling the report we are getting the error : com.google.zxing.client.j2se.MatrixToImageWriter cannot be resolved to a type
Details :
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. com.google.zxing.client.j2se.MatrixToImageWriter cannot be resolved to a type
value = com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage( //$JR_EXPR_ID=38$
<---------------------------------------------->
2. com.google.zxing.client.j2se.MatrixToImageWriter cannot be resolved to a type
value = com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage( //$JR_EXPR_ID=38$
<---------------------------------------------->
3. com.google.zxing.client.j2se.MatrixToImageWriter cannot be resolved to a type
value = com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage( //$JR_EXPR_ID=38$
<---------------------------------------------->
3 errors
.
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:229)
at net.sf.jasperreports.eclipse.builder.JasperReportCompiler.compileReport(JasperReportCompiler.java:289)
at net.sf.jasperreports.eclipse.builder.JasperReportCompiler.compileReport(JasperReportCompiler.java:141)
at net.sf.jasperreports.eclipse.builder.JasperReportsBuilder.compileJRXML(JasperReportsBuilder.java:212)
at com.jaspersoft.studio.editor.action.CompileAction.actionCompile(CompileAction.java:154)
at com.jaspersoft.studio.editor.action.CompileAction$1.run(CompileAction.java:98)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
We have setup the Java Build Path and added Core and JavaSE jars but the report doesn't compile.
The QR code is inserted in the report using the following expression :
com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage(
new com.google.zxing.qrcode.QRCodeWriter().encode(
$F{QRCODE},
com.google.zxing.BarcodeFormat.QR_CODE, 400, 400
)
)
Does anyone know how to solve that please ?
Thanks.
Regards,
[To the person who is closing the question, the question is not about "something cannot be resolved to a type". The question is very specific. And of course I checked the links provided. It just has nothing to do with the question. Every missing type involves specific classes to be added. So sending me a link about : JasperReport org.w3c.tools.codec.Base64Decoder cannot be resolved to a type is just useless. Thank you in advance for your non contribution. You can let other people answer if they are willing to. The most similar question in SO is rather this one. But no answer could be provided]

Related

How to solve om.google.zxing.client.j2se.MatrixToImageWriter cannot be resolved to a type?

[To the person that closed my previous question, the links provided have nothing to do with my question]
I'm trying to create a QR code in JasperSoft Studio.
We have a report properly working on production containing a QR code. But after a new installation of JasperSoft Studio, we are unable to run the report.
While compiling the report we are getting the error : com.google.zxing.client.j2se.MatrixToImageWriter cannot be resolved to a type
Details :
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. com.google.zxing.client.j2se.MatrixToImageWriter cannot be resolved to a type
value = com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage( //$JR_EXPR_ID=38$
<---------------------------------------------->
2. com.google.zxing.client.j2se.MatrixToImageWriter cannot be resolved to a type
value = com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage( //$JR_EXPR_ID=38$
<---------------------------------------------->
3. com.google.zxing.client.j2se.MatrixToImageWriter cannot be resolved to a type
value = com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage( //$JR_EXPR_ID=38$
<---------------------------------------------->
3 errors
.
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:229)
at net.sf.jasperreports.eclipse.builder.JasperReportCompiler.compileReport(JasperReportCompiler.java:289)
at net.sf.jasperreports.eclipse.builder.JasperReportCompiler.compileReport(JasperReportCompiler.java:141)
at net.sf.jasperreports.eclipse.builder.JasperReportsBuilder.compileJRXML(JasperReportsBuilder.java:212)
at com.jaspersoft.studio.editor.action.CompileAction.actionCompile(CompileAction.java:154)
at com.jaspersoft.studio.editor.action.CompileAction$1.run(CompileAction.java:98)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
We have setup the Java Build Path and added Core and JavaSE jars but the report doesn't compile.
The QR code is inserted in the report using the following expression :
com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage(
new com.google.zxing.qrcode.QRCodeWriter().encode(
$F{QRCODE},
com.google.zxing.BarcodeFormat.QR_CODE, 400, 400
)
)
Does anyone know how to solve that please ?
Thanks.
Regards,
[To the person who is closing the question, the question is not about "something cannot be resolved to a type". The question is very specific. And of course I checked the links provided. It just has nothing to do with the question. Every missing type involves specific classes to be added. So sending me a link about : JasperReport org.w3c.tools.codec.Base64Decoder cannot be resolved to a type is just useless. Thank you in advance for your non contribution. You can let other people answer if they are willing to. The most similar question in SO is rather this one. But no answer could be provided]

Jasper Reports: how to add own Functions to Expression Editor

I am using Jaspersoft Studio 6.6 and try to add own functions to the Expression Editor.
Therefore i follow the tutorial Jaspersoft Studio Expression Editor: how to extend it and contribute your own functions (part 2) - updated for version 5.5 (i was not able to find a more current version so i guess this one should be still correct)
All works fine but i had to replace the language of the generated report (SampleFunctionsReport.jrxml) from groovy to java to get rid of class not found exceptions
Finally the following Errors are remaining:
Description Resource Path Location Type
The method HELLO_WORLD_MSG() is undefined for the type SampleFunctions_1541665022158_603382 SampleFunctionsReport.jrxml /MyFunctions line 37 JRXML Problem
The method HELLO_WORLD_MSG() is undefined for the type SampleFunctions_1541665022158_603382 value = HELLO_WORLD_MSG( ); SampleFunctionsReport.jrxml /MyFunctions line 0 JRXML Problem
The method REPEAT_MSG(String, int, boolean) is undefined for the type SampleFunctions_1541665022158_603382 SampleFunctionsReport.jrxml /MyFunctions line 52 JRXML Problem
The method REPEAT_MSG(String, int, boolean) is undefined for the type SampleFunctions_1541665022158_603382 value = REPEAT_MSG("A message that will be probably repeated",5,true); SampleFunctionsReport.jrxml /MyFunctions line 0 JRXML Problem
I checked the points of the tutorial a couple of times...
can someone reproduce my problem?
What am i missing?
<import value="test.customfunctions.*"/>
this is the code from my jrxml, which is fine.
when i tried to enter the full class name - i got an error, that the package cannot be added.
today i tried the same again - and its working. even the resulting XML is identical!

Why do I get current expression is not valid using JRDataSource?

I am trying to use List into the jasper report using JasperSoft Studio, but while defining dataset the JRDataSource expression is showing as invalid even after casting REPORT_DATA_SOURCE to the JRXmlDataSource(find image below).
Expression
((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/Header/FileName")
Error
The current expression is not valid. Please verify it!
The error is looking so weird and I am not able understand it what is wrong here.
Do not worry about it, this is a bug in the IDE.
If you can't close the expression editor, edit the expression manually in the xml view.

the system cannot find the path specified error on Crystal Reports ExportToDisk

I am using Crystal reports in my WPF application to generate reports, getting below error
"the system cannot find the path specified error" on ExportToDisk.
irptDocument = new ReportDocument();
rptDocument.InitReport += new EventHandler(this.OnReportDocInit);
irptDocument.Load(astrReportName);
irptDocument.SetDataSource(adtbResult);
irptDocument.ExportToDisk(ExportFormatType.PortableDocFormat,lstrReportFullName);
Path where to save as pdf is a valid path, still I am getting above error.
This is very common error while we something missing or not set (even for runtime). If you getting error in win7, then also check second link.
While searching answers of your question, someone resolved this error by
I found out the problem; the auto-generated file name seems to have
been too long for the app-server. I changes the name of the class to
PCWS and it worked fine. It's a shame Sun One Studio (which creates
these massive file names doesn't warn you
Please check this links :
https://scn.sap.com/thread/3689925
http://answers.microsoft.com/en-us/windows/forum/windows_7-update/the-system-cannot-find-the-path-specified-error/dae5f759-b053-4a4a-87af-42e79f517631?auth=1

BIRT report with parameters: Can not load the report query

I'm trying to run a report on Birt web viewer (JBoss) with a parameter and I get the following error:
- Grid (id = 1461):
+ Can not load the report query: 1461. Errors occurred when generating the report document for the report element with ID 1,461. (Element ID:1461)
Reports without parameters are working fine. Reports with parameters are running fine in Eclipse Report Designer.
Could someone give me advice please?
I had same kind a problem (ie. the report was throwing error while tried to fetch from the tomcat web container). To resolve this issue, I have added the database driver in the /WEB-INF/lib folder.
Please try this once and let me know if it works.
I solved my problem opening my report with "preview" instead of "frameset". This shows the real exception.
Might be you have not define id in your report parameter,either in report parameter or data set parameter.
In my case, the datasource for BIRT was not configured correctly. I needed to make sure the JNDI name matched what was in the config for my container.