Ans: For purposes of this example, assume we are running on UNIX: if running in Windows instead, use the ".cmd" files rather than the ".sh" files, and substitute references to the Windows file system.
Suppose that the WebLogic Server WL_HOME is /opt/Oracle/Middleware/wlserver_10.3. A domain named base_domain will commonly be located at DOMAINHOME=/opt/Oracle/Middleware/user_projects/domains/base_domain.
There is a startup script startWeblogic.sh under ${DOMAINHOME}. This script calls another startWebLogic.sh under ${DOMAINHOME}/bin. Under ${DOMAINHOME}/bin, there are also other configuration scripts setDomainEnv.sh, startManagedWebLogic.sh, etc. Commonly we will call startWebLogic.sh in DOMAINHOME to start the WLS admin server. Startup then proceeds with these steps:
1) The DOMAINHOME environment variable is set.
2) The script calls ${DOMAINHOME}/bin/startWebLogic.sh.
3) ${DOMAINHOME}/bin/startWebLogic.sh calls ${DOMAINHOME}/bin/setDomainEnv.sh.
4) setDomainEnv.sh calls ${WL_HOME}/common/bin/commEnv.sh. commEnv.sh sets a series of common environment variables, none of which are directly related to the particular domain: for example, WL_HOME, JVM memory options, other JVM parameters, and system properties. These variables are set for use by any WebLogic Server domains, as well as system utilities like Node Manager, etc. A particular domain can (and usually does) override these settings, so setting them here may not actually change the settings for your particular domain. It probably will impact the settings for Node Manager, however.
5) After commEnv.sh is executed, setDomainEnv.sh will set other memory parameters and variables. In fact, the settings from commEnv.sh are overridden here.
6) After setDomainEnv.sh completes, the system returns to ${DOMAINHOME}/bin/startWebLogic.sh, organizes the parameters, and calls java to start up the JVM and start WebLogic Server.
If we want to change the default memory parameters, the best location is in startWebLogic.sh or setDomainEnv. For example, in setDomainEnv.sh, modify the WLS_MEM_ARGS_32BIT from "-Xms512m -Xmx512m" to "-Xms1024m -Xmx1024m".
By the way, if we want to add some additional options, such as "-verbose:class", to the JVM, we could execute the following command before WebLogic start:
set JAVA_OPTIONS=" -verbose:class "
Furthermore, startManagedWebLogic.sh is also usually used. Since WLS 10.3, it has changed to be implemented by calling startWebLogic.sh. There are some options used for connecting to AdminServer which could be setted in the script, such as WLS_USER and WLS_PW, which apear in this script only, although you could insert script manually.
0
Q: What is the difference in setting JAVA_OPTIONS in below 2 files:
$DOMAIN_HOME/bin/setDomainEnv.sh and
$DOMAIN_HOME/bin/startWeblogic.sh
What is the good practice for JAVA_OPTIONS setting?