0

When generating the reports using the DynamicJasper API, the below exception is getting thrown. In my logic, around 5000 to 10000 reports will be generating in single execution. Due to this exception, the report generation exception is totally blocked. Please suggest how to fix this solution without increasing the ulimit option as we can not increase depends on the no.of reports.

net.sf.jasperreports.engine.JRException: Error compiling report java source files : /home/gscsfo/Report_1409558503418_133890.java
com.bnp.scm.services.common.exception.BNPApplicationException: net.sf.jasperreports.engine.JRException: Error compiling report java source files : /home/gscsfo/Report_1409558503418_133890.java

        at com.bnp.scm.services.scheduler.common.SystemLogger.profile(SystemLogger.java:54)
        at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
        at com.bnp.scm.services.scheduler.events.EmailAlertAttachment$$EnhancerByCGLIB$$3c6f687d.getPDFAttachment(<generated>)
        at com.bnp.scm.services.scheduler.events.ScheduleEmailEvent.processEvent(ScheduleEmailEvent.java:1039)
        at com.bnp.scm.services.scheduler.events.ScheduleEmailEvent$$FastClassByCGLIB$$84dbc7ef.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
        at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
        at com.bnp.scm.services.scheduler.common.SystemLogger.profile(SystemLogger.java:54)
        at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
        at com.bnp.scm.services.scheduler.events.ScheduleEmailEvent$$EnhancerByCGLIB$$f22c0d43.processEvent(<generated>)
        at com.bnp.scm.scheduler.job.handler.EmailNotificationJob.run(EmailNotificationJob.java:52)
        at com.bnp.scm.scheduler.job.AbstractJob.execute(AbstractJob.java:79)
        at com.bnp.scm.scheduler.job.AbstractJob$$FastClassByCGLIB$$d1c345af.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
        at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
        at com.bnp.scm.services.scheduler.common.SystemLogger.profile(SystemLogger.java:54)
        at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
        at com.bnp.scm.scheduler.job.handler.EmailNotificationJob$$EnhancerByCGLIB$$b1534990.execute(<generated>)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:206)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:548)
Caused by: net.sf.dynamicreports.report.exception.DRException: net.sf.jasperreports.engine.JRException: Error compiling report java source files : /home/gscsfo/Report_1409558503418_133890.java
        at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toJasperReport(JasperReportBuilder.java:279)
        at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toJasperPrint(JasperReportBuilder.java:309)
        at com.bnp.scm.services.scheduler.events.EmailAlertAttachment.getPDFAttachment(EmailAlertAttachment.java:183)
        ... 56 more
Caused by: net.sf.jasperreports.engine.JRException: Error compiling report java source files : /home/gscsfo/Report_1409558503418_133890.java
        at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:89)
        at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:63)
        at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:188)
        at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:212)
        at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toJasperReport(JasperReportBuilder.java:276)
        ... 58 more
Caused by: java.io.IOException: Cannot run program "javac": java.io.IOException: error=24, Too many open files
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
        at java.lang.Runtime.exec(Runtime.java:593)
        at java.lang.Runtime.exec(Runtime.java:466)
        at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:58)
        ... 62 more
Caused by: java.io.IOException: java.io.IOException: error=24, Too many open files
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
        at java.lang.ProcessImpl.start(ProcessImpl.java:65)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
        ... 65 more
Alex K
  • 22,315
  • 19
  • 108
  • 236
  • When we started analysing, we found that, the streams were not closed in JRJavacCompiler.compileClasses() method. Please someone confirm is this the issue/root cause for the issue.If not,wherelse needs to be fixed. – Ramesh A Sep 01 '14 at 10:54
  • hi Ramesh, have you solved the issue? If not, could you add the code involved? it looks like you are openning streams from files, and those are never closed after the report is generated, but looking at the code would make it easier to spot the problem. If it was solved, could you add an answer with information on how you did it? Thanks! – germanio Feb 26 '15 at 16:06

0 Answers0