facing perm gen space error in weblogic

2020-02-28 03:21发布

问题:

I am new to weblogic. After starting the server when i see administrator console and get log-in it throws below exception.

Root cause of ServletException.
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:335)
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:288)
Truncated. see log file for complete stacktrace

I did lot of google and found some solution to initialize JAVA_OPTIONS like -XX:xmx and etc. I tried to set this in startdomainenv.cmd file but with no luck.

Please help. Any pointers will be highly appreciated.

Thanks.

回答1:

To set PermGen size you can use e.g. -XX:PermSize=512m -XX:MaxPermSize=512m.

Regarding Weblogic, set the JAVA_OPTIONS and see if these options are properly passed in as parameters into your Java process. You can also directly set these parameters in the startWeblogic.cmd script.

To check that your JAVA_OPTIONS are set properly, add echo %JAVA_OPTIONS% into the startWeblogic.cmd script and see the output. Also, you can use e.g. jConsole, jstat, or jmap to monitor Heap usage of the Weblogic process at runtime. This will show you the sizes and occupation of the PermGen.



回答2:

You can try by changing the memory settings of weblogic in your server. * Go to - <weblogic path>\Middleware\user_projects\domains\fms_domain\bin\setDomainEnv.cmd * Open the file * Change the settings

if "%JAVA_VENDOR%"=="Sun" (
set WLS_MEM_ARGS_64BIT=-Xms256m -Xmx512m
set WLS_MEM_ARGS_32BIT=-Xms256m -Xmx512m
) else (
set WLS_MEM_ARGS_64BIT=-Xms512m -Xmx512m
set WLS_MEM_ARGS_32BIT=-Xms512m -Xmx512m
)

Change these settings as per your requirement and environment.



回答3:

to complete the reponse of user267 you must change also : set MEM_MAX_PERM_SIZE_64BIT=-XX:MaxPermSize=256m

set MEM_MAX_PERM_SIZE_32BIT=-XX:MaxPermSize=256m



回答4:

In my case the solution was to edit the DOMAIN\bin\setDomainEnv.cmd file. The following modifications were made before the server would start as intended:

  • The -Xms and -Xmx values were increased
  • the -XX:PermSize and -XX:MaxPermSize values were increased too

and lastly, but probably most importantly

  • the if "%JAVA_VENDOR%"=="Sun" ( conditions were changed to if "%JAVA_VENDOR%"=="Oracle" ( in order to properly recognize my JVM.

Before this last modification the memory changes were only partly reflected to the initialised JVM, and this meant that the parameters regarding the PermGen Space were simply ignored.



回答5:

I just want to share what solved the problem for me: I sourced setDomainEnv.sh and echo ${JAVA_OPTIONS} and noticed that the MEM arguments were not there.

So I added MEM_ARGS to the last setup of the JAVA_OPTIONS.

Like so:
JAVA_OPTIONS="${JAVA_OPTIONS} ${MEM_ARGS}" export JAVA_OPTIONS

Cheers