Exception in thread "http-apr-8080-exec-6" java.lang.OutOfMemoryError: PermGen space 解决!

时间:2021-03-16 18:37:38
Exception in thread "http-apr-8080-exec-6" java.lang.OutOfMemoryError: PermGen space
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904)
	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)


	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
	at voucherList_1378193257591_660717.customizedInit(calculator_voucherList_1378193257591_660717:66)
	at net.sf.jasperreports.engine.fill.JREvaluator.init(JREvaluator.java:88)
	at net.sf.jasperreports.engine.fill.JRCalculator.init(JRCalculator.java:111)
	at net.sf.jasperreports.engine.fill.JRFillDataset.initCalculator(JRFillDataset.java:469)
	at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:529)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:88)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:103)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61)
	at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:153)
	at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:82)
	at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:653)
	at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:969)
	at org.apache.struts2.views.jasperreports.JasperReportsResult.doExecute(JasperReportsResult.java:325)
	at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275)
	at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
	at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)


在网上找了半天,也在apache目录上 bin/catalina.bat文件中的echo Using CATALINA_BASE:   "%CATALINA_BASE%" 上面加入了代码:

  -XX:PermSize=64M -XX:MaxPermSize=128m

但还是没点反应,说也奇怪,不用myElicpse,在apahce里启动可以正常下载jasperreport表格,

原来是我把jasperreport包没有放到lib文件夹下,而是单独在新建了一个jar库,

清空所有部署在apache服务器上的项目,

就好了!

坑人啦!

害的我折腾了半天的时间。。。。。。。。


Java中什么是内存不足错误?

答:在Java中,OutOfMemoryError java.lang.VirtualMachineError的一个子类,当堆内存耗尽时会被JVM抛出。我们能通过设置Java选项来提供更大的内存供应用使用来达到修复的目的。

1
$>java MyProgram -Xms1024m -Xmx1024m -XX:PermSize=64M -XX:MaxPermSize=256m

Exception in thread "http-apr-8080-exec-6" java.lang.OutOfMemoryError: PermGen space 解决!