Jump to content

Recommended Posts

Posted

Hello,

I've a problem when I stop the server. I use jasperreport 6.0.0, tomcat 7.0.55.

When I stop the server I've this stacktrace : 

febr. 12, 2015 2:31:52 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
Grave: The web application [/mywebapp] created a ThreadLocal with key of type [java.lang.ThreadLo
cal] (value [java.lang.ThreadLocal@38a9bc80]) and a value of type [java.lang.Class] (value [class pl
antime_report46jrxml_1423747396799_660787]) but failed to remove it when the web application was sto
pped. Threads are going to be renewed over time to try and avoid a probable memory leak.
 
febr. 12, 2015 2:31:52 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
Grave: The web application [/mywebapp] created a ThreadLocal with key of type [net.sf.jasperrepor
ts.engine.fonts.FontUtil$1] (value [net.sf.jasperreports.engine.fonts.FontUtil$1@7cd7650f]) and a va
lue of type [java.util.HashSet] (value [[]]) but failed to remove it when the web application was st
opped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Here you can find the code : 
 
String reportPath = configurationService.getProperty("report.path");String reportName = configurationService.getProperty("report.pdf");if(!type) { reportName = configurationService.getProperty("report.xls");}File reportFile = new File(reportPath, reportName);File reportCompiledFile = new File(reportPath, reportName + ".jasper");if (!reportCompiledFile.exists() || reportFile.lastModified() > reportCompiledFile.lastModified()){ JasperDesign design = JRXmlLoader.load(reportFile); JasperCompileManager.compileReportToFile(design, reportCompiledFile.getAbsolutePath());}JasperReport report = (JasperReport) JRLoader.loadObject(reportCompiledFile);Driver driver = new Driver();DriverManager.registerDriver(driver);String url = configurationService.getProperty("dataSource.url");String login = configurationService.getProperty("dataSource.username");String pswd = configurationService.getProperty("dataSource.password");Connection con = (Connection) DriverManager.getConnection(url,login, pswd);JasperPrint print = JasperFillManager.fillReport(report, parameters, con);String fileName = parameters.get("lastName") + "-" + FormatUtils.FORMAT_DMYHMS.format(new Date());if(type) { fileName = fileName + ".pdf"; JasperExportManager.exportReportToPdfFile(print, dest.getAbsolutePath()+"\"+fileName);} else { fileName = fileName + ".xls"; JRXlsExporter exporter = new JRXlsExporter(); exporter.setExporterInput(new SimpleExporterInput(print)); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(dest.getAbsoluteFile() + "\" + fileName)); SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration(); configuration.setOnePagePerSheet(false); configuration.setDetectCellType(true); configuration.setCollapseRowSpan(true); exporter.setConfiguration(configuration); exporter.exportReport();}con.close();[/code]
 
The reports are generated in pdf or XLS. It's work fine. How can I removed the problem whith the memory leak ?
 
Can anyone help pls to solve this issue.
Thank you all in anticippation.
 
 
  • 3 years later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...