04 June 2010

Running WLS on Mac OS X with Correct Memory Settings

The shell scripts that launch WLS on Mac OS X don't seem to set the JAVA_VENDOR to Apple, which means that the relevant USER_MEM_ARGS are not specified when the server is started.

To remedy this I've been setting JAVA_VENDOR="Apple" before starting my domain.

But occasionally I forget.  So to automate the setting, I udpated $DOMAIN_DIR/bin/setDomainEnv.sh as follows:

if [ "${JAVA_VENDOR}" = "Oracle" ] ; then
    JAVA_HOME="${BEA_JAVA_HOME}"
    export JAVA_HOME
else
    if [ "${JAVA_VENDOR}" = "Sun" ] ; then
        JAVA_HOME="${SUN_JAVA_HOME}"
        export JAVA_HOME
    else
        if [ "`uname`" = "Darwin" ] ; then
            JAVA_VENDOR="Apple"
            export JAVA_VENDOR

            JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home"
            export JAVA_HOME
    fi
    fi
fi

This then results in the relevant MEM_ARGS for Apple being set later in the script:

if [ "${JAVA_VENDOR}" = "Apple" ] ; then
    MEM_ARGS="${MEM_ARGS} ${MEM_MAX_PERM_SIZE}"
    export MEM_ARGS
fi
Now starting the domain on Mac OS X, the necessary memory arguments are set on the JVM and the server runs as expected.

$ startWebLogic.sh
          ....
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01-279, mixed mode)
Starting WLS with line:
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java -client   -Xms512m -Xmx512m -XX:MaxPermSize=128m -Dweblogic.Name=myserver ...

3 comments:

author said...

Strange, i just installed WLS on Mac OS X and setDomainEnv.sh has the JAVA_VENDOR setting correct already.

Buttso said...

I'll have to check again. Sure I was working from a fresh unzip.

I really do love the fact that I can now unzip, use, delete and unzip again as I see fit.

How are you finding the zip file to use?

-steve-

rc said...

WLS has been pleasantly painless. :)

Are you not running the configuration after unzipping? That might account for missing environment variables.