Error when JasperCompileManager.compileReport(jasperDesign)

0

Hi,

I am using Eclipse Helios with Jaspersoft Studio 1.1.1. I was able to create a report and pull data from Java Bean with Bean Factory. When preview, it successfully show data in the report (only two String fields). Also I noticed that it will compile when you go to preview tab and click run the report.

However, when I use Java to compile and generate report, first it throws "Exception in thread "main" java.lang.NoClassDefFoundError: "; if I include groovy-all-1.7.5.jar in the library, it throws below exception. I searched this forum, and one discussion (http://community.jaspersoft.com/questions/539433/netsfjasperreportsenginejrexception-errors-were-encountered-when-compiling-report) seems has similar problem as mine. However, my report only include two String fields (in Java  Bean, they are String also). I also attach my source code here.

 

Errors were encountered when compiling report expressions class file:

org.codehaus.groovy.control.MultipleCompilationErrorsException

calculator_Blank32A4_1342030798799_371391: 13: unable to resolve class net.sf.jasperreports.expressions.functions.LogicalFunctions

@ line 13, column 1.

calculator_Blank32A4_1342030798799_371391: 14: unable to resolve class net.sf.jasperreports.expressions.functions.TextFunctions

@ line 14, column 1.

calculator_Blank32A4_1342030798799_371391: 15: unable to resolve class net.sf.jasperreports.expressions.functions.MathFunctions

@ line 15, column 1.

calculator_Blank32A4_1342030798799_371391: 16: unable to resolve class net.sf.jasperreports.expressions.functions.DateTimeFunctions

@ line 16, column 1.

calculator_Blank32A4_1342030798799_371391: 13: unable to resolve class net.sf.jasperreports.expressions.functions.LogicalFunctions

@ line 13, column 1.

calculator_Blank32A4_1342030798799_371391: 14: unable to resolve class net.sf.jasperreports.expressions.functions.TextFunctions

@ line 14, column 1.

calculator_Blank32A4_1342030798799_371391: 15: unable to resolve class net.sf.jasperreports.expressions.functions.MathFunctions

@ line 15, column 1.

calculator_Blank32A4_1342030798799_371391: 16: unable to resolve class net.sf.jasperreports.expressions.functions.DateTimeFunctions

@ line 16, column 1.

8 errors

: startup failed:

 

 

xujin_helen's picture
Joined: Jun 25 2012 - 3:59pm
Last seen: 7 years 3 months ago

2 Answers:

0

Hi, 
the missing classes are related to the new functions library introduced for the new expression library.
Please have a look at the following issue in the tracker: #5771.

Summarizing, you should include the needed jars if you make use of the functions in one or more of your expressions.
However as far as I can understand you don't use them. So for now when you compile the report via Java (outside JSS) remove the static imports from jrxml.
So this rows:

    <import value="static net.sf.jasperreports.expressions.functions.LogicalFunctions.*"/>
    <import value="static net.sf.jasperreports.expressions.functions.TextFunctions.*"/>
    <import value="static net.sf.jasperreports.expressions.functions.MathFunctions.*"/>
    <import value="static net.sf.jasperreports.expressions.functions.DateTimeFunctions.*"/>

Starting from the next release, Jaspersoft Studio 1.1.2, there will be a flag to add/remove these static imports when saving the JRXML available in the JSS preference page. 

Best regards,
Massimo.
 

mrabbi's picture
7930
Joined: Oct 31 2011 - 9:20am
Last seen: 2 days 11 hours ago
0

Thanks, it works after removing those import.

Jin

xujin_helen's picture
Joined: Jun 25 2012 - 3:59pm
Last seen: 7 years 3 months ago
Feedback
randomness