我得到以下异常:
org.apache.commons.digester.Digester endElement SEVERE: End event
threw exception java.lang.NoSuchMethodException: No such accessible method: setDatasetRun() on object:
net.sf.jasperreports.engine.design.JRDesignComponentElement
at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:280)
at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220)
at org.apache.commons.digester.Rule.end(Rule.java:257)
at org.apache.commons.digester.Digester.endElement(Digester.java:1345)
at net.sf.jasperreports.engine.xml.JRXmlDigester.endElement(JRXmlDigester.java:199)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown
Source)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:297)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:284)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:273)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:247)
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:338)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:605)
使用作为参数传递的java代码中的资源填充jasper表时出错。它在<DatasetRun>
标记的末尾出现问题。
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#FFFFBF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#FFFFE6">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="Dataset1" whenResourceMissingType="Empty" uuid="1e2809e4-c4b8-405e-a1e7-8ae0e9e4fea6">
<field name="father_Name" class="java.lang.String"/>
<field name="arrival" class="java.lang.String"/>
<field name="entry_Id" class="java.lang.String"/>
<field name="address" class="java.lang.String"/>
<field name="id" class="java.lang.String"/>
<field name="age" class="java.lang.String"/>
<field name="room_Id" class="java.lang.String"/>
<field name="purpose_of_visit" class="java.lang.String"/>
<field name="no_of_person" class="java.lang.String"/>
<field name="person_name" class="java.lang.String"/>
<field name="phone_No" class="java.lang.String"/>
</subDataset>
<parameter name="DS" class="java.util.Collection" isForPrompting="false"/>
<pageHeader>
<band height="163" splitType="Stretch">
<staticText>
<reportElement x="286" y="128" width="255" height="34" uuid="5ea48755-690e-4a65-8b9d-c8b387603f46"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[Naresh Joshi Mob.No.09827401530]]></text>
</staticText>
<line>
<reportElement x="0" y="162" width="802" height="1" uuid="5250fcb9-6f47-402d-872b-a097865d5746"/>
</line>
<staticText>
<reportElement x="0" y="60" width="237" height="20" uuid="b6679ff2-dbb9-46dd-9b4d-4342d8415b3d"/>
<textElement verticalAlignment="Bottom">
<font size="12"/>
</textElement>
<text><![CDATA[0771-2225533/36/4025536]]></text>
</staticText>
<staticText>
<reportElement x="0" y="40" width="255" height="20" uuid="03fd78cb-a28c-459f-9ad9-d66c939e3ab0"/>
<textElement verticalAlignment="Bottom">
<font size="12" isItalic="true"/>
</textElement>
<text><![CDATA[PHOOL CHOWK G E ROAD RAIPUR (C G)]]></text>
</staticText>
<staticText>
<reportElement x="643" y="40" width="138" height="20" uuid="9550d93a-613d-438a-a657-864263511c39"/>
<textElement textAlignment="Center" verticalAlignment="Bottom">
<font size="12"/>
</textElement>
<text><![CDATA[ IT-Pan No. I/D]]></text>
</staticText>
<staticText>
<reportElement x="643" y="60" width="138" height="20" uuid="02efc05d-90aa-4123-9e85-a3edb81b8e24"/>
<textElement textAlignment="Center" verticalAlignment="Bottom">
<font size="12"/>
</textElement>
<text><![CDATA[V-Voter I/D]]></text>
</staticText>
<staticText>
<reportElement x="643" y="80" width="138" height="20" uuid="60306c20-e8b8-49b5-ad65-55c01d4902f5"/>
<textElement textAlignment="Center" verticalAlignment="Bottom">
<font size="12" isBold="false"/>
</textElement>
<text><![CDATA[D-Draving I/D]]></text>
</staticText>
<staticText>
<reportElement x="643" y="100" width="138" height="20" uuid="2b17c9b6-b46d-4a82-a778-d0aa8203fd2e"/>
<textElement textAlignment="Center" verticalAlignment="Bottom">
<font size="12"/>
</textElement>
<text><![CDATA[A-Aadhar card I/D]]></text>
</staticText>
<staticText>
<reportElement x="643" y="20" width="138" height="20" uuid="6c5ffbfc-6283-4182-b18e-9e06ace4ed50"/>
<textElement textAlignment="Center" verticalAlignment="Bottom">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[I/D DETAIL]]></text>
</staticText>
<staticText>
<reportElement x="0" y="20" width="149" height="20" uuid="cf883b66-250e-4b74-8fd0-d8c316ba5479"/>
<textElement verticalAlignment="Bottom">
<font size="15" isBold="true"/>
</textElement>
<text><![CDATA[HOTEL ANJALI]]></text>
</staticText>
<staticText>
<reportElement x="300" y="60" width="50" height="20" uuid="5ccd9833-a509-45f0-95a5-81539624be93"/>
<textElement textAlignment="Center" verticalAlignment="Bottom">
<font size="15" isBold="true"/>
</textElement>
<text><![CDATA[TIME]]></text>
</staticText>
<staticText>
<reportElement x="300" y="40" width="50" height="20" uuid="3fd73703-6a01-4e70-a2a1-b5c05be45c6d"/>
<textElement textAlignment="Center" verticalAlignment="Bottom">
<font size="15" isBold="true"/>
</textElement>
<text><![CDATA[DATE]]></text>
</staticText>
<line>
<reportElement x="0" y="128" width="802" height="1" uuid="45d8d4b5-342c-440d-b45d-a1adba941189"/>
</line>
</band>
</pageHeader>
<detail>
<band height="65" splitType="Stretch">
<componentElement>
<reportElement key="table" style="table" stretchType="RelativeToBandHeight" x="0" y="0" width="802" height="53" uuid="daf88b08-217e-455d-b521-2df6435dc58c"/>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="Dataset1" uuid="f7d90601-36f2-47f4-8593-83af4683e506">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{DS})]]></dataSourceExpression>
</datasetRun>
<jr:column width="33" uuid="0617bcc4-d983-425f-b76b-cc6b4561c4f9">
<jr:columnHeader style="table_CH" height="29" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="32" height="29" uuid="a702fda3-f62a-4961-8e72-1e6a0ccf8114"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Entry No]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="32" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="32" height="32" uuid="bc72afad-a0c5-4045-9978-87c407ae3f40"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{entry_Id}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="38" uuid="47acc93f-23b6-4057-ae9f-c312a2b81f48">
<jr:columnHeader style="table_CH" height="29" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="37" height="29" uuid="e5c92771-f746-4eee-8b09-bc7bcf61ec84"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Room No]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="32" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="37" height="32" uuid="62903eef-eb29-4a78-8aa5-9b20ab807291"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{room_Id}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="40" uuid="1418ef0b-531d-4549-acc8-55e9484523a0">
<jr:columnHeader style="table_CH" height="29" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="40" height="29" uuid="f6a9558d-fb97-47fb-bb25-b5ae8d83d98d"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[NO OF PERSON]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="32" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="40" height="32" uuid="d1a8a28a-92dc-422c-b1d6-f62dad8861d6"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{no_of_person}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="111" uuid="de529060-e154-4198-be70-f710770df7fd">
<jr:columnHeader style="table_CH" height="29" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="111" height="29" uuid="9cdf6f57-50db-408d-9f80-f3dce780b65a"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[NAME IN FULL]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="32" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="111" height="32" uuid="2f7ec4dc-23b2-4f9e-a0e7-8f0816bf65f3"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{person_name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="649f8104-5377-4f2c-a977-2a0746dbea3c">
<jr:columnHeader style="table_CH" height="29" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="90" height="29" uuid="394403fd-0952-49f3-8fed-0dbba9a1a188"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[FATHER]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="32" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="32" uuid="1bebe44e-2825-4b37-8a1b-7f9f3454eeeb"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{father_Name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="30" uuid="02f535c8-7062-4bd0-823a-615c60326ee1">
<jr:columnHeader style="table_CH" height="29" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="30" height="29" uuid="0928bfa0-7670-4b83-9ee8-445dcd7d771c"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[AGE]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="32" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="30" height="32" uuid="e39f425a-490b-4265-832b-566aa7f0d927"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{age}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="123" uuid="0b273947-0b2f-4e9a-aa2b-12c9bcf135f1">
<jr:columnHeader style="table_CH" height="29" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="123" height="29" uuid="e406eb34-b3a1-47a4-b478-ffb811d3c434"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[ADDRESS]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="32" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="123" height="32" uuid="347062d5-366f-43a9-8b15-151e76ab03ef"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="96" uuid="b5eacc74-2cff-4374-9802-2fab492726b5">
<jr:columnHeader style="table_CH" height="29" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="96" height="29" uuid="a9630db7-49f4-4edd-b893-bd8c138a29cb"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[PURPOSE]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="32" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="96" height="32" uuid="79ccdd50-eed4-4693-9e64-1d585e6da874"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{purpose_of_visit}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="63" uuid="0b8d8e2c-35f3-4da5-8306-a668e1fe17e8">
<jr:columnHeader style="table_CH" height="29" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="61" height="29" uuid="43e5af96-abc2-4501-81c5-4103119e2bae"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[ARRIVAL]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="32" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="61" height="32" uuid="defcefd1-b6bf-4342-ad41-62a077347391"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{arrival}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="68" uuid="b4b0d212-cb59-4a70-be5f-e985d7b819f3">
<jr:columnHeader style="table_CH" height="29" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="68" height="29" uuid="37071d97-ac71-448e-a9a5-8bb6d985bbe7"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[PHONE NO]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="32" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="67" height="32" uuid="760ff47d-c507-41bc-9a69-cb31bb3a0d6c"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{phone_No}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="92" uuid="1a109cc6-5003-4822-ba63-eaa903c97be9">
<jr:columnHeader style="table_CH" height="29" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="92" height="29" uuid="47fe8ff4-1956-4fc0-95a4-60f50de120bf"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[ID]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="32" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="92" height="32" uuid="5cd3db0e-f99d-44d2-a585-6c30dddc6f3a"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch">
<textField>
<reportElement x="658" y="14" width="100" height="20" uuid="55a5ba20-94ee-4a1d-ada9-98f8e4776c74"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</columnFooter>
</jasperReport>
我在datasetRun上遇到问题