0

i got following error .

exception

org.apache.jasper.JasperException: Java heap space
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:433)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause

javax.servlet.ServletException: Java heap space
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
    org.apache.jsp.jsp.FileManagement.downloadOut_jsp._jspService(downloadOut_jsp.java:148)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause

java.lang.OutOfMemoryError: Java heap space

How to resolve it ?

Not a bug
  • 4,286
  • 2
  • 40
  • 80
sagar reddy
  • 97
  • 2
  • 8
  • by setting JAVA_OPTS before calling `catalina.[bat|sh]` , for example `JAVA_OPTS=-XX:MaxPermSize=128m -Xmx512m -server`, here `-Xmx512m` set the max heap size. [Here](http://stackoverflow.com/questions/5374455/what-does-java-option-xmx-stand-for) some info about this option – A4L Feb 05 '14 at 08:58
  • possible duplicate of [How to tune Tomcat 5.5 JVM Memory settings without using the configuration program](http://stackoverflow.com/questions/286007/how-to-tune-tomcat-5-5-jvm-memory-settings-without-using-the-configuration-progr) – Stephen C Feb 05 '14 at 08:59
  • But ... why are you still using Tomcat 5.5?? – Stephen C Feb 05 '14 at 09:01

3 Answers3

0

You can pass VM arguments as -Xms1024 in your project properties.

Sorter
  • 9,704
  • 6
  • 64
  • 74
  • I am getting error while downloading a bigger size file in linux machine. But the same is working in testbed machine. Where is the problem then ? – sagar reddy Feb 05 '14 at 09:16
0

If you are using windows, just open up the Apache tomcat properties.

Start -> Programs -> Apache Tomcat -> Tomcat Configuration -> Java

Psypher
  • 396
  • 1
  • 3
  • 13
0

In Eclipse you can set the heap Size by passing VM arguments. Just follow these steps. Goto Run -> Run Configration -> In Arguments tab you have to enter these VM arguments which is : -Xms5m

You can also use System.gc(); to run Garbage Collector forcefully. I know its stupidity because in java it works automatically, but in some cases this stupid idea works.

Anuj Sharma
  • 4,294
  • 2
  • 37
  • 53