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

Why does DataSet and Query editor dialog show valid expression that then doesn't work in Preview?


okorng

Recommended Posts

I'm new to Jasper Reports and am having trouble referencing a nested bean field.  I am running the standalone Jaspersoft Studio 6.0.4.   I add a TextField to the Details band of the new Jasper Report, then double click on the TextField which opens the Expression Editor dialog, then I select the nested bean from the center list which displays all the getter function in the right-side list.  I double-click one of the getters, "getCompanyLegalName()" and the corresponding expression gets added to the editor pane above.  That expression is "$F{userRegistrationStatus}.getCompanyLegalName()"  and it is accepted without any error message.  I then click Finish, then compile the report, then click Preview.  Upon trying to Preview the report it throws an exception stating:

net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $F{userRegistrationStatus}.getCompanyLegalName()
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:506)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$20(ReportControler.java:481)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler$5.run(ReportControler.java:362)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $F{userRegistrationStatus}.getCompanyLegalName()
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:264)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:610)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:578)
at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1015)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:572)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:556)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:454)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2029)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:755)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:262)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:122)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:551)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:119)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: gov.dot.fmcsa.compass.urs.services.urs.URSRegistrationStatus cannot be cast to gov.dot.fmcsa.compass.urs.services.urs.URSRegistrationStatus
at TestReport1_1432323832204_788904.evaluate(TestReport1_1432323832204_788904:201)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:251)
... 14 more

Why is it throwing that class cast exception?  Since when can a class not be cast to itself??  What am I missing here?

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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