1

最近,在重负载下进行测试时,我开始在我的新 jasper 报告应用程序中遇到 PermGen 空间问题。language="groovy通过在我的 jrxml 文件中指定,我使用 groovy 作为报告的表达式评估器。作为 groovy 表达式,在运行时创建类,我怀疑这是 permgen 填充的根本原因。我尝试设置 jvm 选项,例如-XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled,但它无助于解决问题。即使在 excpetion stacktrace(如下所示)中,类加载器也在尝试在失败时将新构建的类加载到 permgen 中。有没有人在使用 groovy 和 jasper 报告时遇到过这个问题?我的报告使用由提供的功能在单独的线程中异步填充AsynchronousFillHandlejasper 提供的课程。这与类加载器没有释放加载的运行时类有任何联系吗?任何建议将不胜感激。

 Exception in thread "Thread-563" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-565"        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.define(ClassLoaderForClassArtifacts.java:42)
        at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts$1.run(ClassLoaderForClassArtifacts.java:86)
        at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts$1.run(ClassLoaderForClassArtifacts.java:84)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.defineClassAndGetConstructor(ClassLoaderForClassArtifacts.java:84)
        at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.compilePogoMethod(CallSiteGenerator.java:215)
        at org.codehaus.groovy.reflection.CachedMethod.createPogoMetaMethodSite(CachedMethod.java:220)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.createCachedMethodSite(PogoMetaMethodSite.java:206)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.createPogoMetaMethodSite(PogoMetaMethodSite.java:182)
        at groovy.lang.MetaClassImpl.createPogoCallCurrentSite(MetaClassImpl.java:3034)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallCurrentSite(CallSiteArray.java:93)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
        at Section_1_1348126593121_343308.evaluate(calculator_Section_1_1348126593121_343308:253)
        at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:190)
        at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:591)
        at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:559)
        at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:884)
        at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:421)
        at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:406)
        at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:257)
        at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:457)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2037)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:771)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:301)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:148)
        at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:909)
4

1 回答 1

2

作为第一个赌注...尝试增加 perm gen 大小,如下所示:

-XX:MaxPermSize=128m

默认为 64m。

希望这可以帮助

于 2012-11-04T14:05:29.240 回答