12

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.

Aleš
  • 8,896
  • 8
  • 62
  • 107
nakul
  • 1,445
  • 7
  • 20
  • 30

5 Answers5

13

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.

Aleš
  • 8,896
  • 8
  • 62
  • 107
  • 1
    This works, just be careful as the JAVA_OPTIONS will effect all of java on your machine that may utilize this system variable. If the problem is specific to Weblogic, alter the setDomainEnv.cmd as Dileep points out. I only mention this because I set this variable to get it working, only to cause issues with my other java versions for other code efforts. – Clint L Dec 04 '15 at 13:11
7

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.

anaximander
  • 7,083
  • 3
  • 44
  • 62
coder1608
  • 171
  • 6
  • 14
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

Karim Oukara
  • 2,638
  • 8
  • 38
  • 51
0

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.

zovits
  • 906
  • 16
  • 27
0

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