Reputation: 278
JasperReports (5.6.1) is not rendering correctly after we dropped a mongo db datasource and passed a object as parameter instead, holding all the information we need within our report. The resulting pdf is always a blank white page now.
Parameter setup:
Map<String, Object> reportParameter = new HashMap<String, Object>();
reportParameter.put("myObject", myObject);
//...
JasperPrint print = JasperFillManager.fillReport(inputStream, reportParameter);
Inside the .jrxml:
<parameter name="myObject" class="de.me.MyObject"/>
<detail>
<band height="572" splitType="Stretch">
<textField>
<reportElement x="57" y="88" width="310" height="14" uuid="9000cf95-9a16-4e89-a9e1-52549680a729"/>
<textFieldExpression><![CDATA[$P{myObject}.getSomething().getAbout().getMe()]]></textFieldExpression>
</textField>
</band>
</detail>
The value that should be rendered is a String, it is cerntainly set and not null.
We are using Java 8. There is no compilation error, but I certainly get one when for example using an undefinded getter like
<![CDATA[$P{myObject}.getSomething().getAbout().getInvalid()]]>
When we use a simple String instead of the object, rendering fails too. But also no error, just a white page.
<![CDATA["foobar"]]>
We think it has nothing to do with the parameter object, instead something is internally broken due to the removed external data source?!
We have no clue what to do here, maybe someone got a hint for us?
Upvotes: 2
Views: 150
Reputation: 121
You could try passing a JREmptyDataSource during report filling where a reference to your Mongo DB Datasource used to be.
The code can be different in your case, but here's an example of how it might look like:
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, new JREmptyDataSource());
Upvotes: 1