ZH/Case-Study-01-Journal-34

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

<返回中文首页> <返回本案例研究首页>

实施日志-34-报错或Bug简易处理

2010-03-05-报错-java.lang.OutOfMemoryError: PermGen space

There is a third generation too - Permanent Generation. The permanent generation is special because it holds meta-data describing user classes (classes that are not part of the Java language). Examples of such meta-data are objects describing classes and methods and they are stored in the Permanent Generation. Applications with large code-base can quickly fill up this segment of the heap which will cause java.lang.OutOfMemoryError: PermGen no matter how high your -Xmx and how much memory you have on the machine.
Sun JVMs allow you to resize the different generations of the heap, including the permanent generation. On a Sun JVM (1.3.1 and above) you can configure the initial permanent generation size and the maximum permanent generation size.
To set a new initial size on Sun JVM use the -XX:PermSize=64m option when starting the virtual machine. To set the maximum permanent generation size use -XX:MaxPermSize=128m option. If you set the initial size and maximum size to equal values you may be able to avoid some full garbage collections that may occur if/when the permanent generation needs to be resized.
  • 于是按照这个方法尝试一下。
  1. 打开文件:$ADEMPIERE_HOME/utils/myEnvironment.sh
  2. 找到:ADEMPIERE_JAVA_OPTIONS="-Xms64M -Xmx512M -DADEMPIERE_HOME=$ADEMPIERE_HOME"
  3. 改为:ADEMPIERE_JAVA_OPTIONS="-Xms512M -Xmx512M -DADEMPIERE_HOME=$ADEMPIERE_HOME" 。也就是把Xms与Xmx调整成大小一样。
  4. 重新启动Server,OK 问题解决。
  • 下面附上JBoss Sever后台报错具体内容:
...OfMemoryError: PermGen space
>>	at java.lang.Class.getDeclaredConstructors0(Native Method)
>>	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>	at java.lang.Class.getConstructor0(Class.java:2699)
>>	at java.lang.Class.newInstance0(Class.java:326)
>>	at java.lang.Class.newInstance(Class.java:308)
>>	at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
>>	at java.security.AccessController.doPrivileged(Native Method)
>>	at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
>>	at sun.reflect.MethodAccessorGenerator.generateSerializationConstructor(MethodAccessorGenerator.java:95)
>>	at sun.reflect.ReflectionFactory.newConstructorForSerialization(ReflectionFactory.java:313)
>>	at java.io.ObjectStreamClass.getSerializableConstructor(ObjectStreamClass.java:1327)
>>	at java.io.ObjectStreamClass.access$1500(ObjectStreamClass.java:52)
>>	at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:437)
>>	at java.security.AccessController.doPrivileged(Native Method)
>>	at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:413)
>>	at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:310)
>>	at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:547)
>>	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1582)
>>	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
>>	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
>>	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
>>	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
>>	at java.util.ArrayList.readObject(ArrayList.java:593)
>>	at sun.reflect.GeneratedMethodAccessor596.invoke(Unknown Source)
>>	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>	at java.lang.reflect.Method.invoke(Method.java:597)
>>	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
>>	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
>>	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
>>	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
>>	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
>>	at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:479)
 [17]
13:12:37,251 ERROR [STDERR] ===========> zkoss.handleError:1130: >>java.lang.OutOfMemoryError: PermGen space
 [16]
13:12:37,256 ERROR [STDERR] -----------> MIssue.set_ValueNoCheck: ReleaseNo - Value too long - truncated to length=4 [16]
13:12:37,256 ERROR [STDERR] -----------> MIssue.set_ValueNoCheck: ReleaseNo - Value too long - truncated to length=4 [16]
13:12:37,306 ERROR [STDERR] ===========> zkoss.handleError:1130: >>java.lang.OutOfMemoryError: PermGen space
 [16]

讨论栏

#01

  • 親愛的祖國團隊 :
  • 複雜的資料要先在資料庫預儲程序先行處理
  • 目前 Adempiere 要修改程式才能在執行 jasper 之前先處理資料庫預儲程序
  • 不要把問題複雜化到自己無法處理
  • 台灣技術支持團隊
  • Skype:Adempiere/Compiere
  • 台灣大哥大 : 0958 222 947 Albert

#02

  • 感谢Albert的指点!之前在ADempiere布署过JasperReports,可能是因为报表较为简单,没有出现PermGen space报错,没有意料到这次会出问题。不知道将来查询数据达到百万级时,会不会遇到其他问题。 --Peanut Blake. Mar 07, 2011.

链接

About this page

  • This page is about how to deal with error or bug in ADempiere in Case Study 01, focusing on simple cases, without concerning complicated debugging.