JR report is not generating on Linux using Struts

2019-09-02 11:08发布

问题:

I've tried to show JR report in Linux. I got an error just now and the production is about in a few hours from now. First it worked fine on Windows. My application server is GlassFish 2.1, OS is RedHat, framework is Struts 2.

I get frustrated because there is no log error (exception) in my log (GlassFish server log). I've checked the connection, it seems fine (using jdbc):

public String getConnection() {
        try {
            Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
            myConnectionObj = DriverManager.getConnection ("jdbc:derby://127.0.0.1:1527/timesheet_db;create=true;user=app;password=app");
        return SUCCESS;
        } catch (Exception e) {
            e.printStackTrace();
            return ERROR;
        }
    } 

My Struts 2 XML for JR:

<action name="ResourcePlan8"
            class="com.promo.accountsys.web.action.ReportResourcePlanAction"
            method="getConnection">
            <result name="success" type="jasper">
                <param name="location">/jasper/ResourcePlanConn9.jasper</param>
                <param name="dataSource">totalEffortProjectList</param>
                <param name="connection">myConnectionObj</param>
                <param name="format">PDF</param>
                <param name="dynamicReport">myDynamicReport</param>
                <param name="layoutManager">classic</param>
                <param name="documentName">Resouce_Plan</param>
                <param name="contentDisposition">application/download</param>
            </result>
            <result name="error">/jsp/report/initreport.jsp</result>
        </action>

Because of the no error log I am lost I think, maybe in generated report I'm missing to configure Linux (still not sure). My friend just had a problem with font but he is using Birt report. He says the report is still generated with default font in Linux, but my error is not showing any report. I think I missed something to configure when I moved it to Linux.

回答1:

Set the property net.sf.jasperreports.awt.ignore.missing.font to true in your jrxml and try. If it generates the report then you can solve the issue by using the font extensions of jasper reports.