Generation report [message #1709674] |
Wed, 30 September 2015 08:49 |
tulfier tulifer Messages: 4 Registered: May 2015 |
Junior Member |
|
|
Hi guys,
Sorry for my bad english .
I generate a report all day in html. This report is integrate in email.
That work fine.
But i have a problem, When i generate a report I don't free memory,
So day after day, the memory is saturate and my JVM crash and I don't see a problem in my code.
Have you got a solution for this problem.
Tomcat 6 (I can't change)
Birt 4.2.2
String folder = System.getProperty("conf");
// Variables pour BIRT Engine
String reportName = "/Rapports/" + nomRapport + ".rptdesign";
IReportEngine engine = null;
IReportRunnable design = null;
IRunAndRenderTask task = null;
HTMLRenderOption renderContext = null;
HashMap contextMap = null;
HTMLRenderOption options = null;
final EngineConfig conf = new EngineConfig();
conf.setEngineHome(this.getClass().getResource("").toString());
conf.setLogConfig(null, Level.FINE);
try {
Platform.startup(conf);
} catch (BirtException e1) {
e1.printStackTrace();
}
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
engine = factory.createReportEngine(conf);
try {
design = engine.openReportDesign(folder + reportName); // Dossier du
// rptdesign
} catch (Exception e) {
System.err.println("Une erreur est survenue pendant l'ouverture du fichier .rptdesign!");
e.printStackTrace();
}
task = engine.createRunAndRenderTask(design);
renderContext = new HTMLRenderOption();
renderContext.setImageDirectory("images");
contextMap = new HashMap();
contextMap.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext);
task.setAppContext(contextMap);
// On affecte les paramètres
task.setParameterValues(this.params);
task.getParameterValues().get("DateDebut");
task.validateParameters();
options = new HTMLRenderOption();
options.setOutputFileName(folder + "/" + nomRapport + ".html"); // Dossier
// de sortie du html
options.setOutputFormat("html");
options.setEmbeddable(true);
task.setRenderOption(options);
try {
task.run();
} catch (Exception e) {
System.err.println("Une erreur est survenue pendant la generation du rapport !");
e.printStackTrace();
}
try {
engine.destroy();
design = null;
task = null;
renderContext = null;
options = null;
factory = null;
} catch (Exception ex) {
engine.destroy();
}
I have a same problem when the people visualize a report on the web interface i use the tag <birt-viewer>. The ram is not free
Thanks
[Updated on: Wed, 30 September 2015 08:57] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02840 seconds