tomcat中的Java堆空间错误 [英] Java Heap Space Error in tomcat

查看:28
本文介绍了tomcat中的Java堆空间错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Tomcat 7.0.28.我已经部署了一个战争文件.在这个战争文件中有一个类似服务器的结构,我们可以在其中上传文件.

I am using Tomcat 7.0.28. I have deployed a war file. In this war file there is a server like structure where we can upload the files.

现在,当我访问该网页时,它可以正常工作,但是当我尝试上传大文件时,却显示 JAVA 堆空间错误.

Now when i access that web page it is working, but when i try to upload the large files it is showing error of JAVA Heap Space.

我该如何解决?

推荐答案

您可能正在尝试将整个文件放入内存中.您的第一个尝试应该是更改 Tomcat JVM 启动选项中的 -Xmx 参数,以提供更多记忆.除此之外,您必须一次读取一个文件块,并将其写入硬盘驱动器,以释放内存.

You are probably trying to put the whole file in memory. Your first shot should be to change the -Xmx parameter at the Tomcat JVM startup options to give it more memor. Aside from that, you'll have to read the file one chunk at a time, and write it on the hard drive, so as to free the memory.

这篇关于tomcat中的Java堆空间错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆