JasperFillManager.fillReportToFile getting GC overhead error for large datasource

0

Please, consider the following code snippet -

JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(jasperReportBeanList);
String printFileName = JasperFillManager.fillReportToFile(templateFilePath, parameters, beanColDataSource);

Here , jasperReportBeanList containing over 250000 records. Now, at the time of executing JasperFillManager.fillReportToFile(templateFilePath, parameters, beanColDataSource) method I am getting GC over exceeded error or out of memory error.

Please, note that I have also added the following line in my code -

DefaultJasperReportsContext context = DefaultJasperReportsContext.getInstance();
JRPropertiesUtil.getInstance(context).setProperty("net.sf.jasperreports.xpath.executer.factory",
                "net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory");

But, still I am getting error.

Any help is appreciated.

sayantanr's picture
Joined: Aug 20 2015 - 4:14am
Last seen: 6 years 5 months ago

Thanks for suggestion. I have tried with virtualizer. But, still I am facing this problem.

 

sayantanr - 6 years 5 months ago

6 Answers:

1

Can you post the exact stack trace?

abc.hegde's picture
166
Joined: Apr 1 2015 - 4:02am
Last seen: 2 years 8 months ago
0

So, how much memory is being used? If it's out of memory, try increasing it.

hozawa's picture
78152
Joined: Apr 24 2010 - 4:31pm
Last seen: 2 years 7 months ago
0

The stack trace is given below -

08:33:32.671 [pool-2-thread-1] ERROR c.n.f.inf.console.ConsoleJobExecutor - Java heap space
java.lang.OutOfMemoryError: Java heap space
    at java.util.zip.InflaterInputStream.<init>(InflaterInputStream.java:88) ~[na:1.7.0_07]
    at java.util.zip.ZipFile$ZipFileInflaterInputStream.<init>(ZipFile.java:387) ~[na:1.7.0_07]
    at java.util.zip.ZipFile.getInputStream(ZipFile.java:368) ~[na:1.7.0_07]
    at java.util.jar.JarFile.getManifestFromReference(JarFile.java:184) ~[na:1.7.0_07]
    at java.util.jar.JarFile.getManifest(JarFile.java:165) ~[na:1.7.0_07]
    at sun.misc.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:756) ~[na:1.7.0_07]
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:416) ~[na:1.7.0_07]
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71) ~[na:1.7.0_07]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.7.0_07]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_07]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_07]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_07]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[na:1.7.0_07]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.7.0_07]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[na:1.7.0_07]
    at net.sf.jasperreports.engine.fill.JRFillContext.dispose(JRFillContext.java:560) ~[jasperreports-5.6.0.jar:5.6.0]
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:1008) ~[jasperreports-5.6.0.jar:5.6.0]
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:892) ~[jasperreports-5.6.0.jar:5.6.0]
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:114) ~[jasperreports-5.6.0.jar:5.6.0]
    at net.sf.jasperreports.engine.JasperFillManager.fillToFile(JasperFillManager.java:505) ~[jasperreports-5.6.0.jar:5.6.0]
    at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:889) ~[jasperreports-5.6.0.jar:5.6.0]
    at com.nri.durga.maf.batch.comparisontool2.ComparisonReportGenerator.createReport(ComparisonReportGenerator.java:1179) ~[durga-maf-SNAPSHOT.jar:na]
    at com.nri.durga.maf.batch.comparisontool2.ComparisonReportGenerator.createReportFile(ComparisonReportGenerator.java:1134) ~[durga-maf-SNAPSHOT.jar:na]
    at com.nri.durga.maf.batch.comparisontool2.ComparisonEngine.checkOutput(ComparisonEngine.java:174) ~[durga-maf-SNAPSHOT.jar:na]
    at com.nri.durga.maf.batch.comparisontool2.ComparisonTool.execute(ComparisonTool.java:64) ~[durga-maf-SNAPSHOT.jar:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_07]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_07]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_07]
    at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_07]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) ~[spring-aop-3.2.2.RELEASE.jar:3.2.2.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) ~[spring-aop-3.2.2.RELEASE.jar:3.2.2.RELEASE]
16:40:10.257 [main] INFO  c.n.f.inf.console.ConsoleJobExecutor - Using default configuration path
16:40:31.286 [main] INFO  c.nrift.finch.inf.startup.Operation - Loading preferenceKeys...
16:40:31.317 [main] INFO  c.nrift.finch.inf.startup.Operation - Loading preference...

sayantanr's picture
Joined: Aug 20 2015 - 4:14am
Last seen: 6 years 5 months ago
0

4GB memory is being used for application. We can not increase more than that.

sayantanr's picture
Joined: Aug 20 2015 - 4:14am
Last seen: 6 years 5 months ago
1

Try using file virtualizer technique so that the generation will not cause out of memory. There might be slight increase in the generation time but you can avoid out of memory issues.

abc.hegde's picture
166
Joined: Apr 1 2015 - 4:02am
Last seen: 2 years 8 months ago
0
marianol's picture
6166
Joined: Sep 13 2011 - 8:04am
Last seen: 3 years 3 months ago
Feedback