swarm357 Posted December 19, 2012 Share Posted December 19, 2012 Im using iReport 5.0.0, jasperreports 4.7.1 and eclispe indigo. My objective is to use iReports to create the jrxml files and then use some java to populate my reports with the data that my clients will provide me at run time. When i try to use my ReportGenRunner.java class to execute my ReportGenerator.run() method i get the follow exception: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:calculator_Report1_1355934859559_852911: 225: unexpected char: '' @ line 225, column 24.1 error at net.sf.jasperreports.compilers.JRGroovyCompiler.compileUnits(JRGroovyCompiler.java:113)at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:201)at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240)at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:496)at com.ahsrcm.mobidash.jasper.java.reports.ReportGenerator.run(ReportGenerator.java:83)at com.ahsrcm.mobidash.jasper.java.reports.runners.ReportGenRunner.main(ReportGenRunner.java:36)Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:calculator_Report1_1355934859559_852911: 225: unexpected char: '' @ line 225, column 24.1 error at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:296)at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:143)at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:113)at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:125)at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:337)at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:99)at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:71)at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:236)at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:158)at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:814)at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:511)at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:487)at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:464)at net.sf.jasperreports.compilers.JRGroovyCompiler.compileUnits(JRGroovyCompiler.java:109)... 5 moreI have been reading various related forums about what might cause this exception to be thrown and i have made changes to all my reports expressions so that any time a field/parameter/variables are converted into int or double primitive types.The thing that is really confusing me is that line 225, column 24 does not contain an experssion in my jrxml. It is the end of one of my conditional style nodes. i have included the section of my jrxml that contains line 225 ...214 215 216 217 218 219 220 221 222 223 new java.lang.Boolean($V{REPORT_COUNT}.intValue()%2 == 1 && $F{ESIBOV__sum}.doubleValue() < 0.0)224 225 226 227 new java.lang.Boolean($V{REPORT_COUNT}.intValue()%2 == 0 && $F{ESIBOV__sum}.doubleValue() < 0.0)228 229 230 231 new java.lang.Boolean($V{REPORT_COUNT}.intValue()%2 == 0)232 233 234 ...here is the method (run() ) that is where i try to use java to compile my report. the variables with '_' before them are my variables that i initalize in my ReportGenerator.java constructor. Note: i do make changes to the jrxml using the java api, however my changes are not anywhere near where the exception is being throw. the report im running this code on has no subreports and i have triple checked that my images are in the right location and that the path string i use to find them are valid. public void run() {_logger.debug("pdf will be at: " + _pdfFileLoc);try{JasperDesign design = JRXmlLoader.load(_jrxmlLoc);JRDesignQuery query = new JRDesignQuery();String initialMaseterQuery = design.getQuery().getText();query.setText(_xPathQuery);design.setQuery(query); // sets all subreports data sources to the same as the master reportfor ( JRBand jrb : design.getAllBands()) { for (JRChild jrc : jrb.getChildren()) {if (jrc instanceof JRDesignSubreport) {JRDesignSubreport jrds = (JRDesignSubreport)jrc; String initialQuery = jrds.getDataSourceExpression().getText();if ( initialMaseterQuery == initialQuery) {JRDesignExpression jrde = new JRDesignExpression("((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource(" + _xPathQuery + ")");jrds.setDataSourceExpression(jrde);_logger.warn("JRDesignSubreport now has datasource expression: " + jrde.getText());} else {throw new RuntimeException("subreport has different query than master report ... implement me!");}} else if (jrc instanceof JRDesignImage) {JRDesignImage image = (JRDesignImage) jrc; JRDesignExpression jre = new JRDesignExpression(_imageDir + "\" + getImageName(image));image.setExpression(jre);_logger.debug("image's new expression=" + image.getExpression().getText());}}} _logger.debug("compiling JasperReport");JasperReport report = JasperCompileManager.compileReport(design); JRXmlDataSource dataSource = new JRXmlDataSource(_xmlDataLoc); _logger.debug("filling JasperPrint");JasperPrint print = JasperFillManager.fillReport(report, _parms, dataSource);JasperExportManager.exportReportToPdfFile(print, _pdfFileLoc + pdfName() ); } catch (JRException jre) { jre.printStackTrace();}} I have tired to use the depeciated JRJdtCompiler in place of JasperCompileManager and that did not work.Does anyone have any ideas as to why this exception is being thrown where it is? has anyone else had a similiar issue with trying to compile jrxml that they have generated using iReport?Thanks in advance or your input/solutions! Link to comment Share on other sites More sharing options...
swarm357 Posted December 19, 2012 Author Share Posted December 19, 2012 my jrxml appear to have not been added ... line 225 is the first instance of the "/conditionalStyle" node in one of my styles Link to comment Share on other sites More sharing options...
swarm357 Posted December 19, 2012 Author Share Posted December 19, 2012 nevermind, i figured out my issue ... i didnt have my image path string formatted properly Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now