如何在Eclipse IDE中增加堆大小以运行Java Web Application?

时间:2014-11-01 15:26:27

标签: java eclipse tomcat heap-memory

如何增加Tomcat HeapSize(JVM堆)?  在服务器控制台上获得以下错误

INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
Nov 01, 2014 8:41:34 PM org.apache.catalina.core.ContainerBase removeChild
SEVERE: ContainerBase.removeChild: destroy: 
org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted               ([before_destroy]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]    in state [STARTING_PREP]
at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:409)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:299)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1041)
at org.apache.catalina.core.ContainerBase.destroyInternal(ContainerBase.java:1234)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1041)
at org.apache.catalina.core.ContainerBase.destroyInternal(ContainerBase.java:1234)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:593)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:822)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305)
at org.apache.catalina.startup.Catalina.start(Catalina.java:695)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)

有人会帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:2)

您可以通过多种方式实现这一目标。 从eclipse可以设置启动配置参数。所有内容都在此link上进行了描述。

另一种方法是在catalina.sh文件中设置CATALINA_OPTS:

export CATALINA_OPTS="-Xms512M -Xmx1024M"

另一种方法是像这样设置JAVA_OPTS:

export JAVA_OPTS="-server -Xmx512m"(但不是tomcat推荐的)。

尝试这些选项并采取解决问题的方法。

我希望有所帮助。