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

Error evaluating expression


sconilleau

Recommended Posts

Hi,

I got the above message while attempting to manipulate a string.

Looks like there is an object type error but I can't find what exactly. Furthermore this syntax still works perfectly with jasperreport-3.7.2.

Any advice about what I should change ?

 

Thx

Sébastien

Code:
Error filling print... Error evaluating expression :      Source text : $F{REPORT_OMIM_DESC}.getSubString( 1, (int)$F{REPORT_OMIM_DESC}.getLength() ) net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :      Source text : $F{REPORT_OMIM_DESC}.getSubString( 1, (int)$F{REPORT_OMIM_DESC}.getLength() )     at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:195)     at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589)     at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:557)     at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:929)     at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:383)     at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:368)     at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)     at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2036)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:760)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946)     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)     at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)     at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:877)     at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)     at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'oracle.sql.CLOB@483e4330' with class 'oracle.sql.CLOB' to class 'oracle.sql.CLOB'     at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:327)     at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:602)     at GeneReport_1300289197985_726519.evaluate(calculator_GeneReport_1300289197985_726519:251)     at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:182)     ... 19 more Print not filled. Try to use an EmptyDataSource...
Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

It's because JR upgraded the version of Groovy that it includes. Groovy does not play nice with backward compatibility.

Optimistic: From the look of your expression, perhaps you set the report language to Groovy only by accident. Set the report language to Java and your problem might be solved.

Pessimistic: If you need Groovy syntax, then you'll either need to downgrade your Groovy or fix the report to use syntax compatible with the later version of Groovy.

Regards,
Matt

Link to comment
Share on other sites

Sébastien,

Now that I look at it more closely... I don't see how that would have worked in 3.7.2.

You write that $F{REPORT_OMIM_DESC} is a String. But the error indicates that it's a CLOB.

I have not worked with CLOBs. I see that getSubString is indeed a method on CLOBs (it's not a method on Strings). But getLength is not a method on CLOBs, so I expect that part should fail.

It also seems really odd to use the getSubString method to get the entire string. I guess it's valid... but why bother?

And last... it really shouldn't be possible to get an error like "org.codehaus.groovy.runtime..." when the report doesn't use Groovy.

But since it DID work in 3.72... and you DO get that error... I'm sort of stuck. Please post a .jrxml file with a single text field (CLOB field?) that reproduces the error.

Regards,
Matt

 

Link to comment
Share on other sites

Hi Matt,

Well, I should avoid asking for help at the end of my workind day because I'm writing many errors ! Here is the real situation :

The field $F{REPORT_OMIM_DESC} is a CLOB in the database but the expression class of the text field in the report is a string. You will see in the joined report that it seems to be a CLOB to string conversion issue because even using the database field without any manipulation gives the same error. I can't explain why there is this getSubString method used to get the entire string since I didn't wrote it and it is not commented.

You're right by saying that "it really shouldn't be possible to get an error like "org.codehaus.groovy.runtime..." when the report doesn't use Groovy". I have been mistaking when writing it. Actually I didn't get exactly the same message by swiching to java for the report language but there was an error at the same position.

Thank you for helping me,

Sébastien

 

Link to comment
Share on other sites

I don't have a quick way to test since I don't have Oracle or even the Oracle JDBC driver installed. I cannot compile the report because I don't have the class oracle.sql.CLOB.

You write "even using the database field without any manipulation gives the same error". But I'm not sure what error you mean. The attached report uses Groovy. When you use Java instead what error do you get?

Regards,
Matt

Link to comment
Share on other sites

Hi Matt,

Concerning the error I mean that if I I use

$F{REPORT_OMIM_CLONING}

in the text expression field instead of

$F{REPORT_OMIM_CLONING}.getSubString( 1, (int)$F{REPORT_OMIM_CLONING}.length() )

I still get an "Error evaluating expression".

 

If I set the report language to java I get this message

Code:
Error filling print... Error evaluating expression :Source text : $F{REPORT_OMIM_CLONING}.getSubString( 1, (int)$F{REPORT_OMIM_CLONING}.length() ) net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :      Source text : $F{REPORT_OMIM_CLONING}.getSubString( 1, (int)$F{REPORT_OMIM_CLONING}.length() )     at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:195)     at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589)     at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:557)     at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:929)     at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:383)     at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:368)     at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)     at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2036)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:760)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946)     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)     at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)     at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:877)     at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)     at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) Caused by: java.lang.ClassCastException: oracle.sql.CLOB     at GeneReport_1300896903746_727946.evaluat (GeneReport_1300896903746_727946:283)     at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:182)     ... 19 more Print not filled. Try to use an EmptyDataSource...
Link to comment
Share on other sites

  • 2 weeks later...

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