在iReport,JasperReports,Struts 2插件中获取null值

时间:2009-05-25 13:48:01

标签: struts2 jasper-reports ireport

我正在使用JasperReportsStruts2在我的网络应用程序中制作一些报告。

我正在使用NetBeans IDE和iReport 3.5.1插件进行设计工作。

我正在按照xml代码配置我的struts2-jasperreports插件。

<package name="jasper1" extends="jasperreports-default,struts-default">
    <result-types>
        <result-type name="jasper" class="org.apache.struts2.views.jasperreports.JasperReportsResult"/>
    </result-types>

    <action name="myJasperTest" class="testJasperAccountAction">

        <result name="success" type="jasper">
            <param name="location">/reports/account.jasper</param>
            <param name="dataSource">accounts</param>
            <param name="format">PDF</param>
        </result>

        <result name="error" type="jasper">/error.jsp</result>

    </action>
</package>

我的动作类如下。

public class JasperAccountAction extends ActionSupport {

    private IAccountSecurityProcessor accountSecurityProcessor;
    private static ArrayList<Account> accounts;

    public void setAccounts(ArrayList<Account> accounts) {
        JasperAccountAction.accounts = accounts;
    }

    @Override
    public String execute() throws Exception {
        return SUCCESS;
    }

    public void setAccountSecurityProcessor(IAccountSecurityProcessor accountSecurityProcessor) {
        this.accountSecurityProcessor = accountSecurityProcessor;
    }

    public ArrayList<Account> getAccounts() throws Exception {
        try {
            accounts = (ArrayList<Account>) this.accountSecurityProcessor.findByAll(0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, false, false, null, null, null, null, 0);

            JasperCompileManager.compileReportToFile("E:\\Final_copy_of_erp\\SufalamERP\\build\\web\\reports\\account.jrxml", "E:\\Final_copy_of_erp\\SufalamERP\\build\\web\\reports\\account.jasper");
            System.out.println("*******************************Accounts list for japser = =" + accounts + " ****************************************");
        } catch (SufalamException ex) {
            ex.printStackTrace();

            System.out.println("*******************************Exception in sufalam ==>" + ex);
            Logger.getLogger(JasperAccountAction.class.getName()).log(Level.SEVERE, null, ex);
        }
        return accounts;
    }
}

我的碧玉报告如下:

<?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="null" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
    <queryString language="SQL">
        <![CDATA[SELECT
     account_master."id" AS account_master_id,
     account_master."name" AS account_master_name
FROM
     "public"."account_master" account_master]]>
    </queryString>
    <field name="account_master_id" class="java.lang.Integer">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="account_master_name" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <group name="account_master_id">
        <groupExpression><![CDATA[$F{account_master_id}]]></groupExpression>
        <groupHeader>
            <band height="27">
                <staticText>
                    <reportElement mode="Opaque" x="0" y="0" width="139" height="27" forecolor="#FFFFFF" backcolor="#000000"/>
                    <textElement>
                        <font size="18"/>
                    </textElement>
                    <text><![CDATA[account_master_id]]></text>
                </staticText>
                <textField>
                    <reportElement mode="Opaque" x="139" y="0" width="416" height="27" forecolor="#FFFFFF" backcolor="#000000"/>
                    <textElement>
                        <font size="18" isBold="true"/>
                    </textElement>
                    <textFieldExpression class="java.lang.Integer"><![CDATA[$F{account_master_id}]]></textFieldExpression>
                </textField>
            </band>
        </groupHeader>
        <groupFooter>
            <band height="8">
                <line direction="BottomUp">
                    <reportElement key="line" x="1" y="4" width="554" height="1"/>
                </line>
            </band>
        </groupFooter>
    </group>
    <background>
        <band/>
    </background>
    <title>
        <band height="58">
            <line>
                <reportElement x="0" y="8" width="555" height="1"/>
            </line>
            <line>
                <reportElement positionType="FixRelativeToBottom" x="0" y="51" width="555" height="1"/>
            </line>
            <staticText>
                <reportElement x="65" y="13" width="424" height="35"/>
                <textElement textAlignment="Center">
                    <font size="26" isBold="true"/>
                </textElement>
                <text><![CDATA[Classic template]]></text>
            </staticText>
        </band>
    </title>
    <pageHeader>
        <band/>
    </pageHeader>
    <columnHeader>
        <band/>
    </columnHeader>
    <detail>
        <band height="20">
            <staticText>
                <reportElement x="0" y="0" width="139" height="20"/>
                <textElement>
                    <font size="12"/>
                </textElement>
                <text><![CDATA[account_master_name]]></text>
            </staticText>
            <textField>
                <reportElement x="139" y="0" width="416" height="20"/>
                <textElement>
                    <font size="12"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{account_master_name}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band/>
    </columnFooter>
    <pageFooter>
        <band height="26">
            <textField evaluationTime="Report" pattern="" isBlankWhenNull="false">
                <reportElement key="textField" x="516" y="6" width="36" height="19" forecolor="#000000" backcolor="#FFFFFF"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement>
                    <font size="10"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
            <textField pattern="" isBlankWhenNull="false">
                <reportElement key="textField" x="342" y="6" width="170" height="19" forecolor="#000000" backcolor="#FFFFFF"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement textAlignment="Right">
                    <font size="10"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression>
            </textField>
            <textField pattern="" isBlankWhenNull="false">
                <reportElement key="textField" x="1" y="6" width="209" height="19" forecolor="#000000" backcolor="#FFFFFF"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement>
                    <font size="10"/>
                </textElement>
                <textFieldExpression class="java.util.Date"><![CDATA[new Date()]]></textFieldExpression>
            </textField>
        </band>
    </pageFooter>
    <summary>
        <band/>
    </summary>
</jasperReport>

我在我的项目中使用了以下的罐子。

asm.jar
cglib.jar
commons-fileupload-1.2.1.jar
displaytag-export-poi-1.2.jar
hibernate3.jar
jasperreports-3.0.0.jar
org.apache.commons.logging_1.0.4.jar
struts2-core-2.0.11.1.jar
tiles-core-2.1.2.jar
xwork-2.1.2.jar
batik-dom.jar
batik-svg-dom.jar
groovy-all-1.5.5.jar
jaxen-1.1.1.jar
jxl-2.6.jar
rhino-1.7R1.jar
commons-lang-2.3.jar
displaytag-portlet-1.2.jar
hibernate-annotations.jar
jdt-compiler-3.1.1.jar
postgresql-8.3-603.jdbc3.jar
struts2-jasperreports-plugin-2.0.11.1.jar
tiles-jsp-2.1.2.jar
batik-anim.jar
batik-ext.jar
batik-svggen.jar
jakarta-bcel-20050813.jar
jcommon-1.0.15.jar
kxml2-2.3.0.jar
xalan.jar
commons-beanutils-1.7.0.jar
commons-logging-1.0.4.jar
dom4j.jar
hibernate-commons-annotations.jar
jta.jar
slf4j-api.jar
struts2-spring-plugin-2.0.11.1.jar
tiles-portlet-2.1.2.jar
batik-awt-util.jar
batik-gvt.jar
batik-util.jar
jasperreports-chart-themes-3.5.1.jar
xml-apis-ext.jar
kxml2-min-2.3.0.jar
xercesImpl.jar
commons-collections.jar
commons-logging-api-1.1.jar
ejb3-persistence.jar
hibernate-core.jar
log4j.jar
slf4j-log4j12.jar
struts2-tiles-plugin-2.1.6.jar
tiles-servlet-2.1.2.jar
batik-bridge.jar
batik-parser.jar
batik-xml.jar
jasperreports-dejavu-fonts.jar
jfreechart-1.0.0.jar    
png-encoder-1.5.jar
commons-digester-1.8.1.jar
displaytag-1.2.jar
freemarker-2.3.8.jar
itext-1.3.1.jar
ognl-2.6.11.jar
spring.jar
tiles-api-2.1.2.jar
xwork-2.0.4.jar
batik-css.jar
batik-script.jar
castor-1.2.jar
JasperReportViewer.jar
jfreechart-1.0.12.jar
poi-3.2-FINAL-20081019.jar

我收到以下错误。

2009-05-29 12:38:58,078 ERROR (org.apache.commons.digester.Digester:1646) - Parse Error at line 2 column 387: Document root element "jasperReport", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "jasperReport", must match DOCTYPE root "null".
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(XMLDTDValidator.java:1621)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1900)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:764)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1359)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1316)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
        at org.apache.commons.digester.Digester.parse(Digester.java:1764)
        at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:239)
        at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226)
        at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)
        at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:168)
        at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:152)
        at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:115)
        at com.sufalam.presentation.finance.action.JasperAccountAction.getAccounts(JasperAccountAction.java:99)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:517)
        at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:931)
        at ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:53)
        at ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:121)
        at com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.getProperty(OgnlValueStack.java:58)
        at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643)
        at com.opensymphony.xwork2.util.CompoundRootAccessor.getProperty(CompoundRootAccessor.java:101)
        at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643)
        at ognl.ASTProperty.getValueBody(ASTProperty.java:92)
        at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
        at ognl.SimpleNode.getValue(SimpleNode.java:210)
        at ognl.Ognl.getValue(Ognl.java:333)
        at ognl.Ognl.getValue(Ognl.java:310)
        at com.opensymphony.xwork2.util.OgnlUtil.getValue(OgnlUtil.java:190)
        at com.opensymphony.xwork2.util.OgnlValueStack.findValue(OgnlValueStack.java:208)
        at org.apache.struts2.views.jasperreports.ValueStackDataSource.<init>(ValueStackDataSource.java:59)
        at org.apache.struts2.views.jasperreports.JasperReportsResult.doExecute(JasperReportsResult.java:204)
        at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
        at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
        at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
        at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
        at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
        at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:167)
        at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at org.ap
ache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
        at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
        at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
        at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
        at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
        at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
        at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
        at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:288)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:647)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:579)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:831)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(Def
aultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
2009-05-29 12:38:58,078  WARN (com.opensymphony.xwork2.util.OgnlValueStack:269) - Caught an exception while evaluating expression 'accounts' against value stack
Caught an Ognl exception while getting property accounts - Class: ognl.OgnlRuntime
File: OgnlRuntime.java
Method: getMethodValue
Line: 935 - ognl/OgnlRuntime.java:935:-1
        at com.opensymphony.xwork2.util.CompoundRootAccessor.getProperty(CompoundRootAccessor.java:106)
        at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643)
        at ognl.ASTProperty.getValueBody(ASTProperty.java:92)
        at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)

3 个答案:

答案 0 :(得分:1)

看起来你的JasperReport.xml只是缺少一个doctype。尝试以这种方式启动文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" 
 "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<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="null" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">

答案 1 :(得分:0)

字段名称应类似于帐户bean的属性名称

答案 2 :(得分:-1)

我遇到了同样的问题,我可以修复它只是从我的bean中输入正确的字段名称

<fieldDescription><![CDATA[correct_name_of_field]]></fieldDescription>,当然还有.jrxml;)

我上了几天。

顺便把所有jasper,apache commons *,poi,itext,jxl的罐子放进去。