ce97
作者ce97·2015-03-31 18:19
软件开发工程师·某某某

Weblogic升级JDK方法

字数 7758阅读 4802评论 0赞 0

1.停止weblogic相关进程

2.获取需更新的JDK包,并解压至/wls/wls81/bea/


3. 修改启动weblogic的JAVA_HOME变量

[wls81@cnsz031527 PrdCSFWLDom380]$ cat servers.env|grepJAVA_HOME

VAR_JAVA_HOME:::JAVA_HOME=/wls/wls81/bea/jrockit-j2sdk1.4.2_08  --修改成新的JDK路径即可

4.重新启动weblogic

5. 验证

 

如下所示:

Alternatives

There are twodifferent approaches that can be used to achieve the required goal. Both willbe described briefly:

A) Installing anew JDK home, and using symbolic link to "rename" the existing andnew JDK directories.

Following thisapproach, the JDK location originally used during the installation will notchange and hence it has the minimal drawback that it might keep a versionedname as for example "$INSTALL_HOME/jdk_<version>".

In any of thecases, this approach is simpler and less error prone than Approach B)

B) Installing a new JDK home directory and replacing the JAVA_HOMEenvironmental variable in *** all *** the scripts referring to it.

This is the preferred approach if you want to do a partial upgrade (affectingto specific domains only, or not affecting to nodemanager), but its difficultyis around on how to know which files do refer to a JDK location.

The initial list of files to change will be :

*$INSTALL_HOME/wlserver_10.3/common/bin/commEnv.sh
* $INSTALL_HOME/user_projects/domains/<mydomain>/bin/setDomainEnv.sh
* $INSTALL_HOME/wlserver_10.3/common/nodemanager/nodemanager.properties
* $INSTALL_HOME/utils/bsu/bsu.sh 
* $INSTALL_HOME/utils/quickstart/quickstart.sh
* $INSTALL_HOME/utils/uninstall/uninstall.sh

even that a moreexhaustive way to determine them, will be to run the following command:

find . -type f-name "*.sh" -exec grep -il JAVA_HOME {} ;

Step by Step Actions

Approach A)

1) Assume thesource and target locations are the following:

sourceJDK:/oracle/wls1033/jdk160_18 
targetJDK: /oracle/wls1033/jdk1.6.0_24

2) Stop all processesthat use the current FMW_HOME. This refers to 

- all the AdminServer and managed_servers in all domains, 
- all the nodemanager processes running in this FMW_HOME, and
- potentially processes running Bea SmartUpgrade at that specific moment.

3) Rename directories:

a) Go to the parent directory of the source JDK:

% cd$INSTALL_HOME/

b) You candetermine whether the location is a symbolic link or not by executing thecommand "ls -ld jdk<version>":

% ls -ld jdk160_18

If the listed information shows jdk160_18 with attributes lrwxrwxrwx (noticethe first 'l') this is a link.
If the listed information shows jdk160_18 with attributes drwxrwxrwx (noticethe first 'd') this is a directory.

c) Move theexisting JDK location to a "backup name", as for example:

% mv jdk160_18jdk160_18.orig

This will renamejdk160_18 to jdk160_18.orig in either case, being it a directory or alink. 

d) And create a symbolic link like this:

% ln -s/oracle/wls1033/jdk1.6.0_24 jdk160_18

e) Validate thatthis step has been completed successfully by running the following command:

%$INSTALL_HOME/jdk160_18/bin/java -fullversion

If this does notreturn the expected version string of the installed JSDK, please checkthe 
validity of the symbolic link or seek additional assistance from your UNIXsystem administrator.

4) Only in thecase that you are using WLS 10.3.6 and the targetJDK is using a certifiedversion of JAVA 7 (version 1.7.0_x) , you will need to copy manually some jarfiles as follows:

Copy the followingfiles from $INSTALL_HOME/modules to  the directory targetJDK/jre/lib/endorsed

javax.annotation_1.0.0.0_1-0.jar

javax.xml.bind_2.1.1.jar

javax.xml.ws_2.1.1.jar

5) Restart theprocesses as normal, they should take the new JDK version.

Approach B)

1) Locate theinvolved JDK versions.

a) sourceJDK: Let's assume theJDK used is $INSTALL_HOME/jdk<version>

For installations done with WLS platform installers (32 bit Windows,Linux, Solaris) the JDK used will be $INSTALL_HOME/jdk<version> .
For installations done with WLS generic installer (64 bit and all otherplatforms) the JDK location can be any other place in the filesystem.



b) targetJDK: Lets assume the new JDK is located at/opt/newjdk

For the examplesabove the following are used:

sourceJDK: /oracle/wls1033/jdk160_18 
targetJDK: /oracle/wls1033/jdk1.6.0_24

2) Stop allprocesses that use the current FMW_HOME. This refers to 

- all the AdminServer and managed_servers in all domains, 
- all the nodemanager processes running in this FMW_HOME, and
- potentially processes running Bea SmartUpgrade at that specific moment.

3) Edit $INSTALL_HOME/wlserver_10.3/common/bin/commEnv.sh and change theJAVA_HOME location. For example, change from:

# Reset JAVA_HOME,JAVA_VENDOR and PRODUCTION_MODE unless JAVA_HOME
# and JAVA_VENDOR are pre-defined.
if [ -z "${JAVA_HOME}" -o -z "${JAVA_VENDOR}" ]; then
# Set up JAVA HOME
JAVA_HOME="/oracle/wls1033/jdk160_18"
# Set up JAVA VENDOR, possible values are
#Oracle, HP, IBM, Sun ...
JAVA_VENDOR=Sun
# PRODUCTION_MODE, default to the development mode
PRODUCTION_MODE=""
fi

To:

# Reset JAVA_HOME,JAVA_VENDOR and PRODUCTION_MODE unless JAVA_HOME
# and JAVA_VENDOR are pre-defined.
if [ -z "${JAVA_HOME}" -o -z "${JAVA_VENDOR}" ]; then
# Set up JAVA HOME
JAVA_HOME="/oracle/wls1033/jdk1.6.0_24"
# Set up JAVA VENDOR, possible values are
#Oracle, HP, IBM, Sun ...
JAVA_VENDOR=Sun
# PRODUCTION_MODE, default to the development mode
PRODUCTION_MODE=""
fi

4) For everydomain, change the domain "setDomainEnv.sh" script to accommodate forthe net JAVA_HOME .

For default location and default scripts, the setDomainEnv.sh will be placedhere:

$INSTALL_HOME/user_projects/domains/<domainName>/bin/setDomainEnv.sh

Check carefullywhere and how the JAVA_HOME environment variable is changed as this mightchange accros versions.

For example in WLS 10.3.3 this will be as follows:

BEA_JAVA_HOME="/oracle/wls1033/jrockit_160_17_R28.0.0-679"
export BEA_JAVA_HOME

SUN_JAVA_HOME="/oracle/wls1033/jdk160_18"
export SUN_JAVA_HOME

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
JAVA_VENDOR="Sun"
export JAVA_VENDOR
JAVA_HOME="/oracle/wls1033/jdk160_18"
export JAVA_HOME
fi
fi

And hence, thechange will have to be done for SUN_JAVA_HOME, to specify the new location:

SUN_JAVA_HOME="/oracle/wls1033/jdk1.6.0_24"
export SUN_JAVA_HOME

5) Change the JDKlocation specified in nodemanager.properties for the default and any otherexisting nodemanager process:

a) Take a backup of$INSTALL_HOME/wlserver_10.3/common/nodemanager/nodemanager.properties

From:

PropertiesVersion=10.3
javaHome=/oracle/wls1033/jdk160_18
AuthenticationEnabled=true
NodeManagerHome=/oracle/wls1033/wlserver_10.3/common/nodemanager
JavaHome=/oracle/wls1033/jdk160_18/jre
LogLevel=INFO

To:

PropertiesVersion=10.3
javaHome=/oracle/wls1033/jdk1.6.0_24
AuthenticationEnabled=true
NodeManagerHome=/oracle/wls1033/wlserver_10.3/common/nodemanager
JavaHome=/oracle/wls1033/jdk1.6.0_24/jre
LogLevel=INFO

6) Replace the newJDK location on all the minor tools used in the same FMW_HOME, such as BSU,uninstall.sh, etc.

For the Bea SmartUpgrade tool $INSTALL_HOME/utils/bsu/bsu.sh

Update this line:

from
JAVA_HOME="/opt/JDK1.6.14"
to
JAVA_HOME="/oracle/wls1033/jdk1.6.0_24"

Similarly, changeJAVA_HOME values for the remaining three files

*$INSTALL_HOME/utils/quickstart/quickstart.sh
* $INSTALL_HOME/utils/uninstall/uninstall.sh

7) Only in thecase that you are using WLS 10.3.6 and the targetJDK is using a certifiedversion of JAVA 7 (version 1.7.0_x) , you will need to copy manually some jarfiles as follows:

Copy the followingfiles from $INSTALL_HOME/modules to  the directory targetJDK/jre/lib/endorsed

javax.annotation_1.0.0.0_1-0.jar

javax.xml.bind_2.1.1.jar

javax.xml.ws_2.1.1.jar

8) Restart all therequired processes.

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

0

添加新评论0 条评论

Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广