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

Type casting error


psinghabhinav

Recommended Posts

i am getting the following error:

Error filling print... java.lang.String cannot be cast to java.lang.Boolean
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean 
    at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:833) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1439) 
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:127) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:903) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:813) 
    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:878) 
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) 
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) 

 when i am trying to run a simple query:

select distinct d.CRM_PROD_CODE from COLLRPTMAST d,colliden b where( d.CRM_SMSID=b.CI_COLL_ID OR d.CRM_SMSID=b.CI_SUP_ID) AND d.CRM_SEQNO=$P{Seq_No}

the class of the parameter is :java.lang.String

and the field CRM_PROD_CODE also belongs to String class.

the variable in the DB also is in varchar format.

Still i am getting this error.

any help would be great.

 

 

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

<?xml version="1.0" encoding="UTF-8"?>

<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="repo_2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">

<property name="ireport.zoom" value="1.0"/>

<property name="ireport.x" value="0"/>

<property name="ireport.y" value="0"/>

<parameter name="Seq_No" class="java.lang.String"/>

<queryString>

<![CDATA[select distinct d.CRM_PROD_CODE from COLLRPTMAST d,colliden b where( d.CRM_SMSID=b.CI_COLL_ID OR d.CRM_SMSID=b.CI_SUP_ID) AND d.CRM_SEQNO=$P{Seq_No}

]]>

</queryString>

<field name="CRM_PROD_CODE" class="java.lang.String"/>

<filterExpression><![CDATA[$P{Seq_No}]]></filterExpression>

<background>

<band splitType="Stretch"/>

</background>

<title>

<band height="79" splitType="Stretch">

<textField>

<reportElement x="139" y="30" width="100" height="20"/>

<textElement/>

<textFieldExpression><![CDATA[$F{CRM_PROD_CODE}]]></textFieldExpression>

</textField>

</band>

</title>

<pageHeader>

<band height="35" splitType="Stretch"/>

</pageHeader>

<columnHeader>

<band height="61" splitType="Stretch"/>

</columnHeader>

<detail>

<band height="125" splitType="Stretch"/>

</detail>

<columnFooter>

<band height="45" splitType="Stretch"/>

</columnFooter>

<pageFooter>

<band height="54" splitType="Stretch"/>

</pageFooter>

<summary>

<band height="42" splitType="Stretch"/>

</summary>

</jasperReport>

//this is my jrxml file

Link to comment
Share on other sites

You have following code in yo JRXML

<filterExpression><![CDATA[$P{Seq_No}]]></filterExpression>[/code]

Here should be an expression with result Boolean or nothing (BTW you have filter in your SQL in WHERE section and definitly dont need additional filter exrpression)

<filterExpression></filterExpression>[/code]

 

It will fix your report

Link to comment
Share on other sites

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