在birt-report插件中运行时,BIRT报告不会打印dataSetRow [“name”]值

时间:2013-03-25 13:18:03

标签: grails birt

我创建了一个简单的BIRT报告,它使用两个不同的DataSet从两个DB表中选择数据。它还有两个传递给DataSet查询的参数。

我的问题是,当我从Eclipse + BIRT环境运行报表时,它会按原样获取所有数据,但是当我从Grails birt-report服务运行报表时,它只打印静态骨架,但不会来自DB的数据。

首先我认为传递给服务的参数值有问题,所以我在报告中添加了一行来打印这些值。这些参数被传递并打印出来 然后我从查询中删除了 where 部分,但仍然没有发生任何事情。该报告在从Eclipse运行时填写,在 birt-report 插件中运行时为空。

这是我用来打印报告的代码:

    params.remove('action')
    params.remove('controller')
    params.remove('name')

    params.put("userId", 10)   //parameter that should be passed
    params.put("resumeId", 5)  //parameter that should be passed

    println params;

    def options = birtReportService.getRenderOption(request, 'doc')
    def result=birtReportService.runAndRender(reportName, params, options)
    response.setHeader("Content-disposition", "attachment; filename=" +reportName + "."+reportExt);
    response.contentType = 'application/doc'
    response.outputStream << result.toByteArray()

任何想法可能是什么原因?

UPD:我如何调试它以查看内部真正发生的事情?

UPD 2:看起来它与应用程序有关,因为当我在新的Grails应用程序中启动报告时,它可以正常工作。

我在查看调试日志时发现的成功和失败启动之间的唯一区别是:

我的应用日志:

[26/03/2013 13:12:36,909] [org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery] [219] ENTRY org.eclipse.birt.data.engine.impl.DataEngineImpl@1ed14cb8 org.eclipse.birt.data.engine.api.querydefn.QueryDefinition@729b6def org.eclipse.birt.data.engine.impl.OdaDataSetAdapter@200ecb05 {org.eclipse.datatools.connectivity.oda.util_consumerResourceIds=org.eclipse.datatools.connectivity.oda.util.ResourceIdentifiers@2b32c5b4, OdaJDBCDriverPassInConnection=Transaction-aware proxy for target Connection  from DataSource [org.apache.commons.dbcp.BasicDataSource@39547eb6], HTML_RENDER_CONTEXT=org.eclipse.birt.report.engine.api.HTMLRenderContext@1251c294, org.eclipse.birt.data.query.ResultBufferSize=100}
[26/03/2013 13:12:36,909] [org.eclipse.birt.data.engine.impl.DataEngineImpl] [219] PreparedQuery starts up.
[26/03/2013 13:12:36,909] [org.eclipse.birt.data.engine.impl.aggregation.AggregateTable] [219] ENTRY
[26/03/2013 13:12:36,909] [org.eclipse.birt.data.engine.impl.aggregation.AggregateTable] [219] RETURN
[26/03/2013 13:12:36,909] [org.eclipse.birt.data.engine.impl.aggregation.AggregateTable] [219] ENTRY C:\Users\SZAGOR~1\AppData\Local\Temp\DataEngine_517033144_2\ [object Object] []
[26/03/2013 13:12:36,909] [org.eclipse.birt.data.engine.impl.aggregation.AggregateTable] [219] RETURN
[26/03/2013 13:12:36,909] [org.eclipse.birt.data.engine.impl.DataEngineImpl] [219] Start to prepare a PreparedQuery.
[26/03/2013 13:12:36,909] [org.eclipse.birt.data.engine.impl.aggregation.AggrRegistry] [219] ENTRY 0 -1 true org.eclipse.birt.core.script.ScriptContext@57b32816
[26/03/2013 13:12:36,909] [org.eclipse.birt.data.engine.impl.aggregation.AggrRegistry] [219] RETURN

//these lines are suspicious
[26/03/2013 13:12:36,909][org.eclipse.birt.data.engine.expression.InvalidExpression] [219] InvalidExpression starts up
[26/03/2013 13:12:36,912] [org.eclipse.birt.data.engine.expression.InvalidExpression] [219] InvalidExpression starts up

[26/03/2013 13:12:36,912] [org.eclipse.birt.data.engine.impl.GroupBindingColumn] [219] ENTRY null 0 {first_name=org.eclipse.birt.data.engine.api.querydefn.Binding@f6678eba, last_name=org.eclipse.birt.data.engine.api.querydefn.Binding@77fdce94, coalesce(resume.mobile_phone, " - ")=org.eclipse.birt.data.engine.api.querydefn.Binding@9beadc7d}

和新的应用日志:

2013-03-26 12:51:08,352 [http-bio-8080-exec-1] DEBUG impl.PreparedDataSourceQuery  - ENTRY org.eclipse.birt.data.engine.impl.DataEngineImpl@79bff971 org.eclipse.birt.data.engine.api.querydefn.QueryDefinition@1799e2e2 org.eclipse.birt.data.engine.impl.OdaDataSetAdapter@1aec9361 {org.eclipse.datatools.connectivity.oda.util_consumerResourceIds=org.eclipse.datatools.connectivity.oda.util.ResourceIdentifiers@21bfd316, OdaJDBCDriverPassInConnection=Transaction-aware proxy for target Connection  from DataSource [org.apache.commons.dbcp.BasicDataSource@38bb5aa9], HTML_RENDER_CONTEXT=org.eclipse.birt.report.engine.api.HTMLRenderContext@143d2a58, org.eclipse.birt.data.query.ResultBufferSize=100}
2013-03-26 12:51:08,352 [http-bio-8080-exec-1] DEBUG impl.DataEngineImpl  - PreparedQuery starts up.
2013-03-26 12:51:08,352 [http-bio-8080-exec-1] DEBUG aggregation.AggregateTable  - ENTRY
2013-03-26 12:51:08,352 [http-bio-8080-exec-1] DEBUG aggregation.AggregateTable  - RETURN
2013-03-26 12:51:08,352 [http-bio-8080-exec-1] DEBUG aggregation.AggregateTable  - ENTRY C:\Users\SZAGOR~1\AppData\Local\Temp\DataEngine_2042624369_1\ [object Object] []
2013-03-26 12:51:08,352 [http-bio-8080-exec-1] DEBUG aggregation.AggregateTable  - RETURN
2013-03-26 12:51:08,352 [http-bio-8080-exec-1] DEBUG impl.DataEngineImpl  - Start to prepare a PreparedQuery.
2013-03-26 12:51:08,362 [http-bio-8080-exec-1] DEBUG aggregation.AggrRegistry  - ENTRY 0 -1 true org.eclipse.birt.core.script.ScriptContext@560fc912
2013-03-26 12:51:08,362 [http-bio-8080-exec-1] DEBUG aggregation.AggrRegistry  - RETURN

// here it's different
2013-03-26 12:51:08,362 [http-bio-8080-exec-1] DEBUG expression.ColumnReferenceExpression  - ENTRY first_name
2013-03-26 12:51:08,362 [http-bio-8080-exec-1] DEBUG expression.ColumnReferenceExpression  - RETURN
2013-03-26 12:51:08,362 [http-bio-8080-exec-1] DEBUG expression.ColumnReferenceExpression  - ENTRY last_name
2013-03-26 12:51:08,362 [http-bio-8080-exec-1] DEBUG expression.ColumnReferenceExpression  - RETURN
2013-03-26 12:51:08,362 [http-bio-8080-exec-1] DEBUG expression.ColumnReferenceExpression  - ENTRY coalesce(resume.mobile_phone, " - ")
2013-03-26 12:51:08,362 [http-bio-8080-exec-1] DEBUG expression.ColumnReferenceExpression  - RETURN
2013-03-26 12:51:08,362 [http-bio-8080-exec-1] DEBUG impl.GroupBindingColumn  - ENTRY null 0 {first_name=org.eclipse.birt.data.engine.api.querydefn.Binding@f6678eba, last_name=org.eclipse.birt.data.engine.api.querydefn.Binding@77fdce94, coalesce(resume.mobile_phone, " - ")=org.eclipse.birt.data.engine.api.querydefn.Binding@9beadc7d}

在这两种情况下都使用了相同的报告文件。

0 个答案:

没有答案