Pergunta

How do I increase the memory used by my Weblogic (Java). While starting the server from eclipse it shows a message that JAVA Memory arguments: -Xms256m -Xmx512m -XX:MaxPermSize=256m. I couldn't understand from where is it taking that value from. After sometime the Weblogic server fails because of low permgen space.

I added startup arguments from console but that doesn't have any effect. Can you help me from where is it taking the memory values from?

Foi útil?

Solução

When you configure a "Server" in Eclipse for WebLogic, you select a domain directory (for local). That domain directory contains the startup scripts that Eclipse will use to start the WebLogic Server. These are the same scripts that you would use if you started the server if you did it without Eclipse. Inside the domain directory is a folder called "bin". In the "bin" directory, locate the setDomainEnv file (.sh for unix, or .cmd for Windows). In that file, alter the memory settings to suite your needs.

Based on the error message you mentioned in your question, I would increase both the PermSize and MaxPermSize settings to 512m. For PermSize and MaxPermSize, there are two locations each by default in a simple WLS installation, one for 32-bit, and another for 64-bit. It won't hurt to change them both. But if you know which JVM architecture you are running, you can change the one that applies to your environment.

Outras dicas

You will have a file setDomainEnv.cmd/setDomainEnv.sh under your server bin folder. this file contains

 set MEM_MAX_PERM_SIZE_64BIT=-XX:MaxPermSize=512m

set MEM_MAX_PERM_SIZE_32BIT=-XX:MaxPermSize=512m

Max and Min memory values as

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
)

You can update the values inside it.

In addition to the previous two answers that are correct (modifying setDomainEnv and potentially wl_server\common\bin\commEnv), you can also modify servers individually if you are starting them with the nodemanager.

In the admin console navigate to:

Servers -> <server name> -> Server Start tab -> Arguments

Here you can set the JVM args you want for that server rather than making a blanket change in all servers to setDomainEnv

Looks like eclipse plugin adds it own USER_MEM_ARGS variable, so it should be rewritten using following approach:
Open following file:

$WL_HOME/user_projects/domains/mydomain/bin/setDomainEnv.sh

and add the next line to it (e.g. after help description)

USER_MEM_ARGS=$ECLIPSE_MEM_ARGS

Then, open weblogic server properties (double click at weblogic in servers view) and click "Open launch configuration". In a opened window select "Environment" and add new variable ECLIPSE_MEM_ARGS with memory params as value, e.g.:

ECLIPSE_MEM_ARGS=-Xms1024m -Xmx2048m -XX:MaxPermSize=512m

Save and check that server was applied new configuration.
P.S. Using this approach you can change/add memory params directly from eclipse.
P.S.S. In Windows you should use setDomainEnv.cmd file and added line should be:

set USER_MEM_ARGS=%ECLIPSE_MEM_ARGS%

For Weblogic12:

Environment->Servers->[your_server]->Configuration/Server Start -> Arguments:

-Xms1024m -Xmx2048m

Restart the server: Environment->Servers->[your_server]->Control/"Start/Stop" -> Suspend and then Start.

Check your memory: Environment->Servers->[your_server]->Monitoring/Performance.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top