当前位置: 首页 > 知识库问答 >
问题:

JasperReport错误:源文本:new java。lang.Integer(1)

常茂
2023-03-14

当我从iReport编译我的. jrxml文件时,我没有问题,一切都很好。但是当我试图从我的Java程序打印时,它显示了这样一个错误:

错误评估表达式:源文:新java.lang.整数(1)

这是我的。jrxml文件

<?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="TOM_list_ot_report" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="822" leftMargin="10" rightMargin="10" topMargin="10" bottomMargin="10" uuid="581e1703-9505-417f-be68-bada03c8d692">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <style name="table">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
        <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>
    <style name="table 1">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 2">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 2_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 2_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 2_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <subDataset name="Table Dataset 1" uuid="8573296a-9744-48d2-bb40-8c4b100b3bc9"/>
    <parameter name="ttLogo" class="java.lang.String"/>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <field name="client" class="java.lang.Object"/>
    <field name="adresse" class="java.lang.Object"/>
    <field name="refCommande" class="java.lang.String"/>
    <field name="codeAccees" class="java.lang.String"/>
    <field name="numeroTt" class="java.lang.String"/>
    <field name="commandeEtat" class="java.lang.Object"/>
    <field name="dateModif" class="java.util.Date"/>
    <field name="dateContractuel" class="java.util.Date"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="89" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="822" height="58" forecolor="#000099" uuid="9d752cf8-e79a-4315-aff6-74fbf7c58a0e"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="28" isBold="true"/>
                </textElement>
                <text><![CDATA[Commande livraison]]></text>
            </staticText>
            <image scaleImage="FillFrame" onErrorType="Blank">
                <reportElement x="3" y="0" width="83" height="58" uuid="f5132dfc-fd13-43b3-9331-2eb7cc813690"/>
                <imageExpression><![CDATA[$P{ttLogo}]]></imageExpression>
            </image>
            <textField pattern="dd/MM/yyyy HH.mm a" isBlankWhenNull="true">
                <reportElement x="681" y="68" width="141" height="20" uuid="af0f8b1b-4a6e-49b7-84d9-d733bdf3f71f"/>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font size="9"/>
                </textElement>
                <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement mode="Transparent" x="663" y="68" width="16" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="7ef40ab2-434f-426f-979e-de7b35e7abac"/>
                <textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" markup="none">
                    <font fontName="SansSerif" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
                    <paragraph lineSpacing="Single"/>
                </textElement>
                <text><![CDATA[LE]]></text>
            </staticText>
            <textField isBlankWhenNull="true">
                <reportElement x="537" y="68" width="123" height="20" isRemoveLineWhenBlank="true" uuid="6892eaba-9d98-43ba-8ca6-8207d840f6ae">
                    <printWhenExpression><![CDATA[($F{adresse} != null) && ($F{adresse}.getRegionDTO() != null)]]></printWhenExpression>
                </reportElement>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font size="10" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{adresse}.getRegionDTO().getLibelleRegion()]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="113" y="68" width="130" height="20" isRemoveLineWhenBlank="true" uuid="7217ea18-cb33-497e-a81d-47693a082e94">
                    <printWhenExpression><![CDATA[($F{adresse} != null) && ($F{adresse}.getRegionDTO() != null)]]></printWhenExpression>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{adresse}.getRegionDTO().getLibelleRegion()]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="3" y="68" width="110" height="20" uuid="97975b5e-d13a-4ccb-9c5a-0ff5e5ccfa33"/>
                <box rightPadding="5"/>
                <textElement verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Direction regionale de  :]]></text>
            </staticText>
        </band>
    </title>
    <pageHeader>
        <band height="21"/>
    </pageHeader>
    <columnHeader>
        <band height="20">
            <rectangle>
                <reportElement x="0" y="0" width="179" height="20" backcolor="#CCFFFF" uuid="6eab9b5b-ac19-432e-991e-00f335d798ea"/>
            </rectangle>
            <rectangle>
                <reportElement x="179" y="0" width="52" height="20" backcolor="#CCFFFF" uuid="17822259-754f-4b8b-8684-f141f6379f3e"/>
            </rectangle>
            <rectangle>
                <reportElement x="231" y="0" width="63" height="20" backcolor="#CCFFFF" uuid="14c21801-ecd6-45c9-8ded-3d72d8fdecfa"/>
            </rectangle>
            <rectangle>
                <reportElement x="294" y="0" width="89" height="20" backcolor="#CCFFFF" uuid="89beeeee-3d35-49fb-93ef-0b997db15681"/>
            </rectangle>
            <rectangle>
                <reportElement x="383" y="0" width="144" height="20" backcolor="#CCFFFF" uuid="07215401-8b52-420d-9b2d-af2b49f11f70"/>
            </rectangle>
            <rectangle>
                <reportElement x="527" y="0" width="140" height="20" backcolor="#CCFFFF" uuid="15d4de45-b59d-40b9-a317-11d3db940cc6"/>
            </rectangle>
            <rectangle>
                <reportElement x="667" y="0" width="64" height="20" backcolor="#CCFFFF" uuid="e32b46cb-8c79-415f-b837-b1e455bc538d"/>
            </rectangle>
            <rectangle>
                <reportElement x="731" y="0" width="91" height="20" backcolor="#CCFFFF" uuid="daa5973a-d676-473a-b4dd-e5a7d2ff3a12"/>
            </rectangle>
            <staticText>
                <reportElement x="0" y="0" width="179" height="20" uuid="c045c618-ae04-4267-9146-0e81a7dcfc9b"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Ref. Commande]]></text>
            </staticText>
            <staticText>
                <reportElement x="179" y="0" width="52" height="20" uuid="7a049ea7-efee-492b-85dc-2524a1ff3ae6"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Numéro]]></text>
            </staticText>
            <staticText>
                <reportElement x="231" y="0" width="63" height="20" uuid="1239f061-63fd-441e-af4a-0cda6c733ff7"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Id Access]]></text>
            </staticText>
            <staticText>
                <reportElement x="294" y="0" width="89" height="20" uuid="cd63d966-725e-4e23-8127-d97559e2651f"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Nom et prénom ]]></text>
            </staticText>
            <staticText>
                <reportElement x="383" y="0" width="144" height="20" uuid="bd6a1270-45e2-432b-86b3-ec6b0d86d7c9"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Adresse installation]]></text>
            </staticText>
            <staticText>
                <reportElement x="527" y="0" width="140" height="20" uuid="a6bb97eb-d4d5-4188-ae80-51ca1706c1c7"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Etat commande]]></text>
            </staticText>
            <staticText>
                <reportElement x="667" y="0" width="64" height="20" uuid="6c678f82-a385-4c95-80cc-609d3506ab19"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Date état]]></text>
            </staticText>
            <staticText>
                <reportElement x="731" y="0" width="91" height="20" uuid="a47f5765-1f07-4b8a-ba9b-ac330bedffa8"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Date contractuel]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="32" splitType="Stretch">
            <rectangle>
                <reportElement x="0" y="0" width="179" height="32" uuid="ec0f3d1e-71e0-49a8-af72-3b878bc1737d"/>
            </rectangle>
            <rectangle>
                <reportElement x="179" y="0" width="52" height="32" uuid="fe0f82ad-508a-493a-af0f-835a93a3c9ea"/>
            </rectangle>
            <rectangle>
                <reportElement x="231" y="0" width="63" height="32" uuid="4e6fefd5-9b92-451c-a4f0-a91e7d68c8f0"/>
            </rectangle>
            <rectangle>
                <reportElement x="294" y="0" width="89" height="32" uuid="552df758-27c4-4800-b499-9be13265694c"/>
            </rectangle>
            <rectangle>
                <reportElement x="383" y="0" width="144" height="32" uuid="5bcb83e6-3cbb-443a-83b9-ddedf55c573e"/>
            </rectangle>
            <rectangle>
                <reportElement x="527" y="0" width="140" height="32" uuid="102743e9-f3cf-4100-a616-b0adb77dec36"/>
            </rectangle>
            <rectangle>
                <reportElement x="667" y="0" width="64" height="32" uuid="071d3f95-5839-43ac-8bb2-9fb85df2f7c0"/>
            </rectangle>
            <rectangle>
                <reportElement x="731" y="0" width="91" height="32" uuid="5567c999-0396-46e1-b876-a9c496f38267"/>
            </rectangle>
            <textField isBlankWhenNull="true">
                <reportElement x="6" y="0" width="169" height="32" isRemoveLineWhenBlank="true" uuid="e364eaad-cfb7-4df7-95cb-831522e56594"/>
                <textElement verticalAlignment="Middle">
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{refCommande}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="184" y="0" width="42" height="32" isRemoveLineWhenBlank="true" uuid="9ee64eaf-d92e-469a-bd84-150309c21fda"/>
                <textElement verticalAlignment="Middle">
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{numeroTt}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="236" y="0" width="53" height="32" isRemoveLineWhenBlank="true" uuid="5a3954a9-378f-4879-afac-11732b8dcf23"/>
                <textElement verticalAlignment="Middle">
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{codeAccees}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="299" y="0" width="79" height="32" isRemoveLineWhenBlank="true" uuid="4b2c6948-0b49-4950-93c9-a6fa8f579032">
                    <printWhenExpression><![CDATA[$F{client} != null]]></printWhenExpression>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{client}.getFullName()]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="388" y="0" width="134" height="32" isRemoveLineWhenBlank="true" uuid="4e8bf206-9f34-4633-b070-225bb02bb9a5">
                    <printWhenExpression><![CDATA[$F{adresse} != null]]></printWhenExpression>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{adresse}.getAdresseLabel()]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="532" y="0" width="130" height="32" isRemoveLineWhenBlank="true" uuid="6085dd50-e9e6-47e9-9622-577e224b4306">
                    <printWhenExpression><![CDATA[$F{commandeEtat} != null]]></printWhenExpression>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{commandeEtat}.getLibEtatCmd()]]></textFieldExpression>
            </textField>
            <textField pattern="dd/MM/yyyy h.mm a" isBlankWhenNull="true">
                <reportElement x="672" y="0" width="54" height="32" isRemoveLineWhenBlank="true" uuid="3b8f5c69-ae9c-4dd8-9f8f-00ed310d39c5"/>
                <textElement verticalAlignment="Middle">
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{dateModif}]]></textFieldExpression>
            </textField>
            <textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
                <reportElement x="737" y="0" width="81" height="32" isRemoveLineWhenBlank="true" uuid="33512a65-6207-4805-93a2-4cc48c580ac4"/>
                <textElement verticalAlignment="Middle">
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{dateContractuel}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <pageFooter>
        <band height="14"/>
    </pageFooter>
</jasperReport>

有什么想法吗?

更新我试图把语言改成Java。我在编译时遇到了一些错误:

The method getRegionDTO() is undefined for the type Object  
The method getRegionDTO() is undefined for the type Object  
The method getRegionDTO() is undefined for the type Object  
The method getFullName() is undefined for the type Object   
The method getAdresseLabel() is undefined for the type Object   
The method getLibEtatCmd() is undefined for the type Object

共有1个答案

夏飞掣
2023-03-14

我刚刚将版本更改为groovy 2.0.1。我的groovy 1.7.5版本与jasper 5.5.0不匹配。

这篇帖子帮助我解决了这个问题。

 类似资料:
  • 问题内容: 首先,我在iReport 5.1.0中制作了一个R_D1.jrxml文件。 我执行报告的Java代码如下所示: 当我执行该类时,出现以下异常: 我不确定自己在做什么错,或者这个异常意味着什么。 问题答案: 这里的主要问题是您尚未编译文件。将JRXML文件视为Java源文件。要运行Java文件,您必须先对其进行编译,然后才能运行。jrxml文件只是人类可读的XML文件,它描述了您想要发生

  • 我需要一些关于JasperReport的帮助,这是我的模板 下面是主要类:

  • 我正在使用; 雄猫8 Jasper iReport 5.6也尝试了Jasper Studio 6.1 Tomcat/lib/jasper报告-6.1.1 Tomcat/lib/mysql-连接器-java-5.1.34-bin Tomcat/lib/commons-beanutils-1.9.0.jar Tomcat/lib/commons-collections-3.2.1.jar Tomcat

  • 我的问题与生成报告时的错误有关。 在JasperReports Server中创建了一个单输入控制值,但当您尝试生成报告时,我得到了错误: 在预览版iReport中,一切都完美无瑕。我将输入值并生成报告。

  • 我正在使用intellij创建sbt跨编译平台项目,使用以下平台JVM、JS、NativeWin、NativeUbuntu、Android和共享scala代码。我的项目需要Java8,但似乎Android不适合Java8版本,因为我在sbt文件中为Android模块指定了1.7版本,如下所示: Android模块文件 项目设置:

  • 在遵循《开发者指南》中给出的示例之后,我得到了以下信息: 设置: 布局: 完整日志: 网址肯定有效(我已经尝试了其他几个)。我错过了什么? 更新: 当我在本地加载视频时,播放器确实工作了。不过这并不能解决我的问题。