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

No such accessible method: addField() on object


jasperlady

Recommended Posts

Hi

 

I'm actually new to jasper reports and was able to make jasper report fine but when i want to include the pie chart in summary page i was running into the below problem

 

net.sf.jasperreports.engine.JRException: java.lang.NoSuchMethodException: No such accessible method: addField() on object: net.sf.jasperreports.engine.design.JRDesignField

 

Please some one help me on this,Its very urgent for me

 

From this xml file from the summary section if i take out the piechart section report was running fine

 

Here is my Jasper xml fine

 

Please help me on this as soon as someone noticed a issue

 

Code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport name="DataSourceReport" pageWidth="595" pageHeight="1100" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50">
<style name="Arial_Normal" isDefault="true" fontName="Arial" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<style name="Arial_Bold" isDefault="false" fontName="Arial" fontSize="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<style name="Arial_Italic" isDefault="false" fontName="Arial" fontSize="12" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<parameter name="ReportTitle" class="java.lang.String">
</parameter>
<parameter name="DataFile" class="java.lang.String">
</parameter>
<parameter name="SummaryImage" class="java.awt.Image">
</parameter>
<field name="dlr_name" class="java.lang.String">
</field>
<field name="dlr_code" class="java.lang.String">
</field>
<field name="cwsid" class="java.lang.String">
</field>
<field name="subtotal" class="java.lang.String">
<field name="numTotal" class="java.lang.Double">

</field>
<variable name="CityNumber" class="java.lang.Integer" incrementType="Group" incrementGroup="CityGroup" calculation="Count">
<variableExpression><![CDATA[boolean.TRUE]]></variableExpression>
</variable>

<variable name="FreightSumCountryGroup" class="java.lang.Double" resetType="CityGroup" resetGroup="CityGroup" calculation="Sum">
<variableExpression><![CDATA[$F{numTotal}]]></variableExpression>
</variable>

<group name="CityGroup" minHeightToStartNewPage="60">
<groupExpression><![CDATA[$F{dlr_name}]]></groupExpression>
<groupHeader>
<band height="20">
<textField evaluationTime="Group" evaluationGroup="CityGroup" bookmarkLevel="1">
<reportElement mode="Opaque" x="0" y="5" width="515" height="15" backcolor="#8A2BE2" forecolor="white" style="Arial_Bold"/>
<box leftPadding="10">
<bottomPen lineWidth="1"/>
</box>
<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{CityNumber}) + ". " + String.valueOf($F{dlr_name})]]></textFieldExpression>
<anchorNameExpression><![CDATA[string.valueOf($F{dlr_name})]]></anchorNameExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="20">
<staticText>
<reportElement x="400" y="1" width="60" height="15" style="Arial_Bold"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Count :]]></text>
</staticText>
<textField>
<reportElement x="460" y="1" width="30" height="15" style="Arial_Bold"/>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{CityGroup_COUNT}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<title>
<band height="70">

<textField isBlankWhenNull="true" bookmarkLevel="1">
<reportElement x="0" y="10" width="515" height="30" style="Arial_Normal"/>
<textElement textAlignment="Center" markup="styled" >
<font size="22" isItalic="true"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA["<style color="red" isBold="true">" + $P{ReportTitle} + "</style>"]]></textFieldExpression>
<anchorNameExpression><![CDATA["Title"]]></anchorNameExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="0" y="40" width="515" height="20" style="Arial_Normal"/>
<textElement textAlignment="Center">
<font size="14"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{DataFile}]]></textFieldExpression>
</textField>
</band>
</title>

<pageHeader>
<band height="20">

<staticText>
<reportElement mode="Opaque" x="0" y="5" width="155" height="15" forecolor="blue" backcolor="orange" style="Arial_Bold"/>
<textElement textAlignment="Center">
<font size="12"/>
</textElement>
<text><![CDATA[CWSID]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="155" y="5" width="105" height="15" forecolor="blue" backcolor="orange" style="Arial_Bold"/>
<text><![CDATA[Dealer Code]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="260" y="5" width="255" height="15" forecolor="blue" backcolor="orange" style="Arial_Bold"/>
<text><![CDATA[sub Total]]></text>
</staticText>
</band>
</pageHeader>
<detail>
<band height="15">
<textField bookmarkLevel="2">
<reportElement x="0" y="0" width="155" height="15"/>
<box leftPadding="10" rightPadding="10">
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{cwsid}]]></textFieldExpression>
<anchorNameExpression><![CDATA[$F{cwsid} + " (" + $F{cwsid} + "«»)"]]></anchorNameExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="155" y="0" width="105" height="15"/>
<box leftPadding="10" rightPadding="10">
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
</box>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{dlr_code}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="260" y="0" width="255" height="15"/>
<box leftPadding="10" rightPadding="10">
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{subtotal}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="40">
<line>
<reportElement x="0" y="10" width="515" height="1"/>
<graphicElement/>
</line>
<textField>
<reportElement x="200" y="20" width="80" height="15"/>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="280" y="20" width="75" height="15"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<lastPageFooter>
<band height="60">
<textField bookmarkLevel="1">
<reportElement x="0" y="10" width="515" height="15"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA["There were " +
String.valueOf($V{REPORT_COUNT}) +
" address records on this report."]]></textFieldExpression>
<anchorNameExpression><![CDATA["Summary"]]></anchorNameExpression>
</textField>
<line>
<reportElement x="0" y="30" width="515" height="1"/>
<graphicElement/>
</line>
<textField>
<reportElement x="200" y="40" width="80" height="15"/>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="280" y="40" width="75" height="15"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
</textField>
</band>
</lastPageFooter>
<summary>
<band height="300">
<frame>
<reportElement x="0" y="10" width="555" height="290" backcolor="#c0c0c0" mode="Opaque"/>
<box>
<pen lineWidth="1"/>
</box>
<image>
<reportElement x="5" y="5" width="550" height="285"/>
<graphicElement/>
<imageExpression class="java.awt.Image"><![CDATA[$P{SummaryImage}]]></imageExpression>
</image>

</frame>

<pieChart>
<chart evaluationTime="None" >
<reportElement positionType="Float" x="0" y="25" width="270" height="175"/>
</chart>
<pieDataset>
<dataset incrementType="None" />
<keyExpression>$F{dlr_code}</keyExpression>
<valueExpression>$V{FreightSumCountryGroup}</valueExpression>
<sectionHyperlink hyperlinkType="Reference" hyperlinkTarget="Blank">

<hyperlinkReferenceExpression>"http://en.wikipedia.org/wiki/" + $F{dlr_code}</hyperlinkReferenceExpression>

<hyperlinkTooltipExpression><![CDATA["Read more about " + $F{dlr_code}]]></hyperlinkTooltipExpression>

</sectionHyperlink>

</pieDataset>
<piePlot>
<plot/>
</piePlot>
</pieChart>


</band>
</summary>

</jasperReport>
Link to comment
Share on other sites

  • Replies 2
  • 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...