我有Jboss 7.1.1 AS,当我将其作为服务运行时,经过一段时间我使用jasper报告后,我得到异常:java.lang.OutOfMemoryError:PermGen space
请注意,当我从Jboss开发人员工作室运行时,这根本不会发生。
我该怎么办?
错误堆栈:
at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.7.0_79]
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2585) [rt.jar:1.7.0_79]
at java.lang.Class.getConstructor0(Class.java:2885) [rt.jar:1.7.0_79]
at java.lang.Class.newInstance(Class.java:350) [rt.jar:1.7.0_79]
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399) [rt.jar:1.7.0_79]
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:396) [rt.jar:1.7.0_79]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_79]
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:395) [rt.jar:1.7.0_79]
at sun.reflect.MethodAccessorGenerator.generateSerializationConstructor(MethodAccessorGenerator.java:113) [rt.jar:1.7.0_79]
at sun.reflect.ReflectionFactory.newConstructorForSerialization(ReflectionFactory.java:331) [rt.jar:1.7.0_79]
at java.io.ObjectStreamClass.getSerializableConstructor(ObjectStreamClass.java:1376) [rt.jar:1.7.0_79]
at java.io.ObjectStreamClass.access$1500(ObjectStreamClass.java:72) [rt.jar:1.7.0_79]
at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:493) [rt.jar:1.7.0_79]
at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:468) [rt.jar:1.7.0_79]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_79]
at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:468) [rt.jar:1.7.0_79]
at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:365) [rt.jar:1.7.0_79]
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:602) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1622) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370) [rt.jar:1.7.0_79]
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:249) [jasperreports-5.6.1.jar:5.6.1]
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:233) [jasperreports-5.6.1.jar:5.6.1]
at net.sf.jasperreports.repo.SerializedObjectPersistenceService.load(SerializedObjectPersistenceService.java:59) [jasperreports-5.6.1.jar:5.6.1]
at net.sf.jasperreports.repo.SerializedReportPersistenceService.load(SerializedReportPersistenceService.java:43) [jasperreports-5.6.1.jar:5.6.1]
at net.sf.jasperreports.repo.DefaultRepositoryService.getResource(DefaultRepositoryService.java:155) [jasperreports-5.6.1.jar:5.6.1]
答案 0 :(得分:1)
您可以尝试在服务器bin文件夹中的standalone.conf.bat
中为您的JBoss引发 PermSize 。
查找集&#34; JAVA_OPTS=-Xms64M -Xmx512M -XX:MaxPermSize=256M
&#34;并根据您的要求更改 MaxPermSize 。
我不太了解开发人员工作室,但它可能会为服务器设置PermGem而忽略standalone.conf.bat(具有更高的值),因此您的报告可以正常工作。
但是,您需要搜索报告中可能导致 OutOfMemoryError 的任何泄漏。
希望它有所帮助。