留言板

java.lang.OutOfMemoryError: PermGen space

Hari Krishnan Rathnakumar,修改在15 年前。

java.lang.OutOfMemoryError: PermGen space

Junior Member 帖子: 60 加入日期: 08-12-16 最近的帖子
Hi liferay guys,

I was finished liferay integration with tomcat6.0, but whenever I try to upload(Using Document Library) any file I got below exception

javax.servlet.ServletException: Servlet execution threw an exception
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:98)
com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.doFilter(VirtualHostFilter.java:149)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:98)
com.liferay.portal.servlet.filters.sessionid.SessionIdFilter.doFilter(SessionIdFilter.java:81)
com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:137)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:98)
com.liferay.filters.strip.StripFilter.doFilter(StripFilter.java:88)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:98)
com.liferay.filters.compression.CompressionFilter.doFilter(CompressionFilter.java:109)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:98)
com.liferay.filters.secure.SecureFilter.doFilter(SecureFilter.java:150)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:98)
com.liferay.filters.doubleclick.DoubleClickFilter.doFilter(DoubleClickFilter.java:132)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:98)
com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter.doFilter(LayoutCacheFilter.java:190)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:98)
com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.doFilter(AutoLoginFilter.java:108)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:98)
com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.doFilter(VirtualHostFilter.java:173)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:98)
com.liferay.portal.servlet.filters.sessionid.SessionIdFilter.doFilter(SessionIdFilter.java:81)
root cause
java.lang.OutOfMemoryError: PermGen space
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
org.apache.jackrabbit.core.WorkspaceImpl.<init>(WorkspaceImpl.java:134)
org.apache.jackrabbit.core.SessionImpl.createWorkspaceInstance(SessionImpl.java:285)
org.apache.jackrabbit.core.SessionImpl.<init>(SessionImpl.java:253)
org.apache.jackrabbit.core.SystemSession.<init>(SystemSession.java:66)
org.apache.jackrabbit.core.SystemSession.create(SystemSession.java:54)
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.getSystemSession(RepositoryImpl.java:1634)
org.apache.jackrabbit.core.RepositoryImpl.initWorkspace(RepositoryImpl.java:546)
org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:379)
org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:286)
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:521)
org.apache.jackrabbit.core.TransientRepository$2.getRepository(TransientRepository.java:245)
org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:265)
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:333)
com.liferay.portal.jcr.jackrabbit.JCRFactoryImpl.createSession(JCRFactoryImpl.java:73)
com.liferay.portal.jcr.JCRFactoryUtil.createSession(JCRFactoryUtil.java:53)
com.liferay.portal.jcr.JCRFactoryUtil.createSession(JCRFactoryUtil.java:57)

how can I solve this problem. Any body help me.

Any help is highly appreciated

Hari R
thumbnail
Suresh Nimmakayala,修改在15 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Liferay Master 帖子: 690 加入日期: 04-8-18 最近的帖子
all depends on how much ram you have on that system and memory settings. look in the forum on by 'PermGen space'. you will find a answer

Cheers
Suresh
thumbnail
Derek Nerenberg,修改在15 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Junior Member 帖子: 41 加入日期: 06-5-9 最近的帖子
I've had this problem in Eclipse trying to color code very large JSP or XML files. I'm sure your issue is much different, but the symptom is the same. Check out http://www.jroller.com/agileanswers/entry/preventing_java_s_java_lang as a starting point to debug the issue.
Hari Krishnan R,修改在15 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Junior Member 帖子: 60 加入日期: 08-12-16 最近的帖子
Hi Suresh and Derek

Thank you for your reply,

My machine having 1 GB ram, and I have also increase the java heap memory for tomcat server
By appending the below line in catalina.bat
set JAVA_OPTS ="-Xms256m -Xmx2048m -XX:MaxPermSize=2048m"
Kindly suggests me to how to sort out this pblm.

Thanks in advance.
thumbnail
Mika Koivisto,修改在15 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Liferay Legend 帖子: 1519 加入日期: 06-8-7 最近的帖子
Your current memory settings would require more than 5GB of physical RAM. With only 1GB of physical RAM you could use following settings
set JAVA_OPTS ="-Xms256m -Xmx512m -XX:MaxPermSize=196m"


This might not be enough for your application and if that's the case then you need to add more RAM to your machine in order to increase java heap size or perm size. You should notice that above java memory settings won't leave any space for your OS. In Windows you need to reserve a minimum of 512MB for the OS.
Hari Krishnan R,修改在15 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Junior Member 帖子: 60 加入日期: 08-12-16 最近的帖子
Thanks Guys for your help.

I need one more help I want to skip all the pages between login and public Organization Page.I need to change the code for that.
From where can i change that code?.kindly let me know the details.


my need id: sing in -------------to-----------> (welcome/my places/<organization name>) public page



how can i find source.....

Thanks in advance
thumbnail
Ziggy .,修改在14 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Expert 帖子: 293 加入日期: 08-6-8 最近的帖子
Mika Koivisto:
Your current memory settings would require more than 5GB of physical RAM. With only 1GB of physical RAM you could use following settings
set JAVA_OPTS ="-Xms256m -Xmx512m -XX:MaxPermSize=196m"


This might not be enough for your application and if that's the case then you need to add more RAM to your machine in order to increase java heap size or perm size. You should notice that above java memory settings won't leave any space for your OS. In Windows you need to reserve a minimum of 512MB for the OS.


Hi could you explain to me how this memory allocation works? I have a machine with 2GB physical im getting out of memory errors. How do i set the values for a 2GB machine?

And also can the swap partition be used to help?

Thanks
thumbnail
Olaf Kock,修改在14 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
Swap space helps and doesn't help at the same time: It can prevent OutOfMemory conditions because you mimic more ram than you actually have. On the other hand it does so through notable performance impacts when the swap space it hit. Still better than an application stopping to work, but not desirable.

Regarding the settings: These are Sun JRE settings, especially the -XX is Sun proprietary. You can find loads of good resorces regarding MaxPermGen on the net - there's some nice explanations what areas of memory the options are denoting and why you want to control them in certain conditions.
thumbnail
Zsolt Balogh,修改在14 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Expert 帖子: 463 加入日期: 09-3-23 最近的帖子
If you are developing liferay, here are my settings(tomcat):

-Xms265m -Xmx768m -XX:MaxPermSize=512m

I don't know if it's recommended or not, but I have no OutOfMemoryErrors with these.

For production it's not enough in most cases, I have a portal running with these(jboss):

-Xms6144m -Xmx8192m -XX:MaxPermSize=512m -XXemoticonermSize=256m
thumbnail
Ziggy .,修改在14 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Expert 帖子: 293 加入日期: 08-6-8 最近的帖子
Zsolt, How much memory have you got on that production environment?
thumbnail
Zsolt Balogh,修改在14 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Expert 帖子: 463 加入日期: 09-3-23 最近的帖子
16G

But it's a really heavy portal with a lot of communities, users and visitors.
thumbnail
Ziggy .,修改在14 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Expert 帖子: 293 加入日期: 08-6-8 最近的帖子
Thats a lot of memory!
I am only running with 2GB but hoping to upgrade soon.
thumbnail
Olaf Kock,修改在14 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
We have sites running with even less than 2GB - though they are relatively low traffic and the machines are virtual, so adding memory is a matter of clicking the mouse a few times. So far we're happy with that.
thumbnail
Krati Gupta,修改在13 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Regular Member 帖子: 119 加入日期: 08-12-5 最近的帖子
Hi All,

I am using 4 GB of RAM and -Xms512m -Xmx1500m -XX:MaxPermSize=128m
and after that I am getting the outOfMemory error . So please tell us what should be the ideal seeting for the production environment .
thumbnail
Olaf Kock,修改在13 年前。

RE: java.lang.OutOfMemoryError: PermGen space

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
The ideal setting depends on what applications/portlets you're running and what the load of your system is. For production systems I'd recommend to have -Xmx and -Xms to be the same, as you sooner or later will use up all that memory, and you don't want that to fail (or trigger swapping) at some unforseeable point in time but rather immediately on start up.

Regarding your OutOfMemory: Determine if its heap space or PermGen space and up the appropriate value. You might get some value from the performance whitepaper