Sorry to be raising this question!
but … I’m using this method for creating report in pdf.
public void gerarRelatorio(final AnalitApplication app, Collection<?> dados, final HashMap<String, String> parametrosRelatorio) {
try {
final JRBeanCollectionDataSource jrBcDs = new JRBeanCollectionDataSource(dados);
final JasperReport relatorioJasper = (JasperReport)JRLoader.loadObject(getClass().getClassLoader().getResourceAsStream("analitPessoas.jasper"));
} catch (Exception e) {
e.printStackTrace();
}
StreamResource.StreamSource source = new StreamResource.StreamSource() {
public InputStream getStream() {
byte[] b = null;
try {
b = JasperRunManager.runReportToPdf(relatorioJasper, parametrosRelatorio, jrBcDs);
} catch (Exception e) {
e.printStackTrace();
}
return new ByteArrayInputStream(b);
}
};
StreamResource resource = new StreamResource(source, "myreport_" + System.currentTimeMillis() + ".pdf", app);
app.getMainWindow().open(resource, "_self");
}
On localhost works 100%, since the server does not.
When calling the report, the Vaadin opens a new window with the
address “http://mferreira.net/Analit/APP/2/myreport_1329328432944.pdf”,
showing a new instance of my application instead of creating the pdf.
The tomcat log shows no error.
I am using eclipse + hibernate+Vaadin+tomcat6 (localhost and server)+jaspereports.
Analit ...
META-INF
MANIFEST.MF
VAADIN
(themes)
WEB-INF
classes
net (packages and classes)
analitPessoas.jasper
lib
(.jars)
web.xml