Tomcat在启动时抛出OutOfMemoryError

时间:2014-11-04 16:58:01

标签: tomcat jvm tomcat7

错误和跟踪:

尝试在Windows 32位计算机上启动Tomcat 7.0.28时,我看到以下OutOfMemoryError错误:

SEVERE: Error waiting for multi-thread deployment of WAR files to complete
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap s
pace
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:752
)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1413)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:313)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase
.java:401)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:34
6)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1159)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java
:785)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.
java:1595)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.
java:1585)
...

如果您需要更多痕迹,请告诉我。

我尝试了什么:

我已尝试关注this solutionthis question about my OutOfMemoryError,但未成功。更具体地说,遵循catalina.sh ...

中的指令
#   Do not set the variables in this script. Instead put them into a script
#   setenv.sh in CATALINA_BASE/bin to keep your customizations separate.

...我在setenv.sh中创建了CATALINA_BASE/bin。该文件的全部内容为:

SET CATALINA_OPTS="$CATALINA_OPTS -Xms512M -Xmx1024M"

重启服务器后,我看到同样的错误。有帮助吗?感谢。

1 个答案:

答案 0 :(得分:1)

你说你使用的是Windows,但你已经创建了一个Unix shell脚本" .sh"。将其重命名为" .bat"。 set命令应如下所示:

SET "CATALINA_OPTS=%CATALINA_OPTS% -Xms512m -Xmx1g -XX:MaxPermSize=256m"