Discussions

EJB design: Tomcat java.lang.OutOfMemoryError

  1. Tomcat java.lang.OutOfMemoryError (3 messages)

    I am running a web application using jsp pages on tomcat 4.1. When I try to access a certain jsp page I get the following error. I'm running on Windows XP.

    I'd appreciate any suggestions.



    StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
    javax.servlet.ServletException: Filter execution threw an exception
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:534)
    ----- Root Cause -----
    java.lang.OutOfMemoryError
  2. Tomcat java.lang.OutOfMemoryError[ Go to top ]

    Are you trying to create a very big object in the memory in that JSP. I mean you might be creating some array or reading something in an infinate loop into the memory.. (My guess).

    Basically a variable in the JSP is requiring a lot of memory.

    Hope this helps.

    Rakesh.
  3. I'm not too sure if this works in tomcat 5 these days, but for post 5.0 versions, set the following environment variables and you shouldn't have any problems:

    CATALINA_OPTS=-mx163577856
    TOMCAT_OPTS=-mx163577856

    Now I think the CATALINA_OPTS is for 4.0, where TOMCAT_OPTS is for pre 4.0..

    What can cause this to happen by the way is a large collection or map in memory for example, this can also be at the servlet and may not be fault of the jsp.
  4. thank you[ Go to top ]

    the error was caused by a large map and when I added to the tomcat server:
    -Xms128m
    and
    -Xmx396m

    it worked.
    Lucille