eclipse java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java 堆空间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12155973/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 18:52:29  来源:igfitidea点击:

java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space

javaeclipsetomcat

提问by Vimal

I created a sample JSF/JDBC project in Eclipse Indigo which is deployed to Tomcat 7. When I put mysql-connector-java-5.1.21.jarin /WEB-INF/lib, then I get the following errors:

我在部署到 Tomcat 7 的 Eclipse Indigo 中创建了一个示例 JSF/JDBC 项目。当我输入mysql-connector-java-5.1.21.jar/WEB-INF/lib,我收到以下错误:

One from Eclipse:

一个来自 Eclipse:

Server Tomcat v7.0 Server at localhost (8) was unable to start within 120 seconds. If the server requires more time, try increasing the timeout in the server editor.

Server Tomcat v7.0 Server at localhost (8) 无法在 120 秒内启动。如果服务器需要更多时间,请尝试在服务器编辑器中增加超时时间。

And another one from Tomcat:

另一个来自 Tomcat:

SEVERE: Error waiting for multi-thread deployment of context descriptors to complete
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:574)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1413)

How are they caused and how can I solve it?

它们是如何引起的,我该如何解决?

回答by Mikko Maunu

As the error says, you are out of heap space. Try to provide more heap by giving following JVM argument when starting tomcat:

正如错误所说,您的堆空间不足。尝试通过在启动 tomcat 时提供以下 JVM 参数来提供更多堆:

java -Xmx1024m

Actual "right" amount depends about your hardware setup and requirements of application.

实际“正确”数量取决于您的硬件设置和应用程序要求。

回答by nitind

Tomcat is the process running out of memory, not Eclipse. Open the Tomcat instance from your Servers view and edit its Launch Configuration. From the Arguments tab, give it a larger maximum heap size.

Tomcat 是内存不足的进程,而不是 Eclipse。从您的服务器视图中打开 Tomcat 实例并编辑其启动配置。从 Arguments 选项卡中,给它一个更大的最大堆大小。

回答by Mohammod Hossain

stop Tomcat v7.0 server and again run it. You can try to change java heap size

停止Tomcat v7.0 服务器并再次运行它。您可以尝试更改java堆大小

Edit eclipse-home/eclipse.ini to be something like the following and restart Eclipse. -vmargs -Xms256m -Xmx1024m

将 eclipse-home/eclipse.ini 编辑为如下所示的内容并重新启动 Eclipse。-vmargs -Xms256m -Xmx1024m