Exception in thread "http-bio-8080-exec-18"

本文详细解析了在Linux CentOS环境下,使用Java运行时遇到PermGen空间不足引发的OutOfMemoryError问题,并提供了解决方案。重点在于理解PermGen空间的作用、产生的原因及调整配置的方法。

linux centos 下报错Exception in thread "http-bio-8080-exec-18" java.lang.OutOfMemoryError: PermGen space


错误信息:
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-7" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-8" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-13" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-14" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-15" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-16" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-17" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-18" java.lang.OutOfMemoryError: PermGen space

 

Exception in thread "DispatcherThread" java.lang.OutOfMemoryError: PermGen space
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space
Exception in thread "State Saver" java.lang.OutOfMemoryError: PermGen space
Exception in thread "AWT-Windows" java.lang.OutOfMemoryError: OutOfMemoryError 内容来自www.awzsr.com

错误原因:
PermGen space的全称是Permanent Generation space,是指内存的永久保存区域,这块内存主要是被JVM存放Class和Meta信息的,Class在被Loader时就会被放到PermGen space中,它和存放类实例(Instance)的Heap区域不同,GC(Garbage Collection)不会在主程序运行期对PermGen space进行清理,所以如果你的应用中有很多CLASS的话,就很可能出现PermGen space错误,这种错误常见在web服务器对JSP进行pre compile的时候。如果你的WEB APP下都用了大量的第三方jar, 其大小超过了jvm默认的大小(4M)那么就会产生此错误信息了。

 


catalina.sh 的第236行

 

# Uncomment the following line to make the umask available when using the
# org.apache.catalina.security.SecurityListener
#JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.security.SecurityListener.UMASK=`umask`"

 

#=============此部分是增加的代码==============
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1024m
-Xmx1024m -XX:NewSize=512m -XX:MaxNewSize=256m -XX:PermSize=512m
-XX:MaxPermSize=512m -XX:+DisableExplicitGC"
#=============此部分是增加的代码==============

 


# ----- Execute The Requested Command ----------------------------------------- www.awzsr.com

回答: "Exception in thread "Thread-7" Exception in thread "Thread-6" java.lang.NullPointerException" 是一个运行时异常,通常是由于程序在尝试使用一个空引用对象(null)的某个成员变量或方法时触发的。这种异常通常会在代码中出现类似于引用\[1\]中的情况,即在使用一个空引用对象的成员变量或方法时触发。在引用\[2\]中的代码示例中,如果ShowFrame对象为空,那么调用setVisible方法时就会触发NullPointerException异常。同样,在引用\[3\]中的代码示例中,如果textArea对象为空,那么在尝试获取其文本内容时就会触发NullPointerException异常。因此,为了避免出现NullPointerException异常,我们需要在代码中检查所有可能为空的地方,并确保所得到的对象不为空。 #### 引用[.reference_title] - *1* *3* [没有指出具体哪一行Exception in thread “AWT-EventQueue-0“ java.lang.NullPointerException](https://blog.youkuaiyun.com/beiback/article/details/130994161)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Exception in thread “AWT-EventQueue-0“ java.lang.NullPointerException](https://blog.youkuaiyun.com/qq_66763612/article/details/125350730)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值