Jump to content

Recommended Posts

Posted

Hi Friend,

             This is Uduman, I am coming very long time here. I want to generate Marksheet as a pdf file but I got 10 pdf file(for 10 student) condinuously and suttendly got PermGen space error here. I am using Jasper 5.6.0, Java 1.7 and iText-2.1.7.jar.

My Code:

public String marksheetgeneration(){
HashMap<String, Object> hm = null;
JREmptyDataSource ds = null;
String jasperPath = null;
byte[] bytes = null;
File reportFile = null;
String name = null;
try {
StudentMarkGenerateDAO dao = new StudentMarkGenerateDAO();
hm = new HashMap<String, Object>();
ds = new JREmptyDataSource();
jasperPath = (String) session.getServletContext().getAttribute("JasperPath");
hm = dao.getStudentCourseList(branchId, academicYear, semesterId, searchstatus, searchstatus, studentId);
 
if (hm.size() > 0) {
name = hm.get("registerNumber")+"_SEM"+semesterId;
hm.put("path", jasperPath);
 
ServletOutputStream servletOutputStream = response.getOutputStream();
response.reset();
 
reportFile = new File(jasperPath+ "RegularMarkSheet.jasper");
bytes = JasperRunManager.runReportToPdf(reportFile.getPath(), hm, ds);
hm.clear();
 
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment;filename="+name+".PDF");
response.setContentLength(bytes.length);
 
servletOutputStream.write(bytes, 0, bytes.length);
servletOutputStream.flush();
servletOutputStream.close();
 
if(searchstatus == 1)
studentList = dao.getStudentList(branchId, academicYear, semesterId, searchstatus,1);
else if(searchstatus == 2)
studentList = dao.getStudentList(branchId, academicYear, semesterId, searchstatus,2);
setSuccess("Report has been taken successfully");
} else {
setError("Report not has been taken successfully");
}
filtercontent();
return "studentsuccess";
} catch(Exception e){
setError("Report not has been taken successfully");
LOGGER.error(e.getMessage(), e);
return ERROR;
}
}
 
My Error:
Jun 15, 2015 5:38:22 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Jun 15, 2015 5:46:22 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8083"]
Jun 15, 2015 5:46:24 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8049"]
Jun 15, 2015 5:46:26 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
oader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:132)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:130)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:172)
at org.apache.jasper.servlet.JspServletWrapper.getDependants(JspServletWrapper.java:288)
at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:488)
at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:425)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:639)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:473)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:455)
at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:324)
at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:191)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
Exception in thread "http-bio-8083-exec-7" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8083-exec-3" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8083-exec-4" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8083-exec-1" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8083-exec-2" Exception in thread "http-bio-8083-exec-9" java.lang.OutOfMemoryError: PermGen space
java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8083-exec-8" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8083-exec-5" java.lang.OutOfMemoryError: PermGen space
Exception in thread "ContainerBackgroundProcessor[standardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8083-exec-6" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8083-exec-11" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8083-exec-12" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8083-exec-15" Exception in thread "http-bio-8083-exec-14" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8083-exec-13" java.lang.OutOfMemoryError: PermGen space
java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8083-Acceptor-0" java.lang.OutOfMemoryError: PermGen space
Exception in thread "ajp-bio-8049-Acceptor-0" java.lang.OutOfMemoryError: PermGen space
 
After occurred this error, server derminated suttenly. Please help me for this error.

 

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Posted

How much memory have you assigned to JasperReports?

As you know, pdf are generated all in memory first before being sent back. This means you'll need more memory.

 

Posted

Hi Hozawa,

           Thanks for your response, I've given lot of memory for jasper. But error is not for that, Actually lot of back up project had in webapp folder, I deleted all back up project from webapp folder and refresh then run the application pdf generated well. I can generate marksheet as pdf now. 

 

Thanks

Uduman

 

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...