java.lang.OutOfMemoryError: PermGen space

If you are developing JEE applications with low resources (like me ) probably you have been facing “java.lang.OutOfMemoryError: PermGen space” exception and it will be your nightmare. Sample stack trace of exception:

StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
java.lang.OutOfMemoryError: PermGen space
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(
at sun.reflect.MethodAccessorGenerator$
at Method)
at sun.reflect.MethodAccessorGenerator.generate(
at sun.reflect.MethodAccessorGenerator.generateMethod(
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(

You should add these parameters to domail.xml to get rid of this exception ( it is not exact solution) :