()

Steps to Upgrade Java version in Weblogic 12.2

In this article, we are going to perform a change Java version in Weblogic 12.2. There are 2 methods to change Java versions in Weblogic 12c.

1. Installed JAVA tar file in a new location and changed JAVA version/location in all respected scripts.

2. Best and simple method installed new java location and create a symbolic link.

In today’s post, we are going to change the java version in Weblogic 12.2 using the second method. Below are the steps to follow to update the java version/location in Weblogic.


Step1:-
Create JAVA dir into /u02 mount point.

Here we are creating JAVA dir into /u02 mount point you can use any mount point according to your organization’s policy or standard norms.

root@DbsGurus ~]# cd /u02
[root@DbsGurus u02]# mkdir JAVA
root@DbsGurus u02]# ls -lrt
drwxr-xr-x.  2 oracle oracle    6 Nov 18 12:02 JAVA


Step2:-
Download JDK tar(archive) file.

We have to download the jdk1.8 version from Oracle support and copy the JDK file into /u02/JAVA. 

[oracle@DbsGurus tmp]$ cd /u02/JAVA/
[oracle@DbsGurus JAVA]$ cp /tmp/jdk-8u271-linux-x64.tar.gz .
[oracle@DbsGurus JAVA]$ ls -lrt
total 139788
-rw-rw-r--. 1 oracle oracle 143142634 Nov 18 12:07 jdk-8u271-linux-x64.tar.gz


Step3:-
untar/unpack jdk tar file.

Below is the step to untar jdk-8u271-linux-x64.tar.gz.

[oracle@DbsGurus JAVA]$ tar -xvf jdk-8u271-linux-x64.tar.gz
[oracle@DbsGurus JAVA]$ ls -lrt
total 139792
drwxr-xr-x. 8 oracle oracle      4096 Sep 16 13:14 jdk1.8.0_271
-rw-rw-r--. 1 oracle oracle 143142634 Nov 18 12:07 jdk-8u271-linux-x64.tar.gz


Step4:-
Create a symbolic link.

[oracle@DbsGurus JAVA]$ ln -s /u02/JAVA/jdk1.8.0_271 latest

[oracle@DbsGurus JAVA]$ ls -lrt
total 139792
drwxr-xr-x. 8 oracle oracle      4096 Sep 16 13:14 jdk1.8.0_271
-rw-rw-r--. 1 oracle oracle 143142634 Nov 18 12:07 jdk-8u271-linux-x64.tar.gz
lrwxrwxrwx. 1 oracle oracle        22 Nov 18 12:09 latest -> /u02/JAVA/jdk1.8.0_271


Step5:-
Below are the WebLogic script that we need to update.


5.1:-
Edit JAVA_HOME into nodemanager.properties.

[oracle@DbsGurus nodemanager]$ pwd
/u01/app/oracle/Middleware/user_projects/domains/base_domain/nodemanager
[oracle@DbsGurus nodemanager]$ vi nodemanager.properties

1 #Fri Apr 10 00:51:12 EDT 2020
  2 #Node manager properties
  3 #Thu Apr 09 19:31:55 EDT 2020
  4 DomainsFile=/u01/app/oracle/Middleware/user_projects/domains/base_domain/nodemanager/nodemanager.domains
  5 LogLimit=0
  6 PropertiesVersion=12.2.1.3.0
  7 AuthenticationEnabled=true
  8 NodeManagerHome=/u01/app/oracle/Middleware/user_projects/domains/base_domain/nodemanager
  9 JavaHome=/u02/JAVA/latest


5.2:-
Edit JAVA_HOME into setDomainEnv.sh

[oracle@DbsGurus bin]$ cd
$MW_HOME/user_projects/domains/base_domain/bin
[oracle@DbsGurus bin]$ vi setDomainEnv.sh
99 BEA_JAVA_HOME=""
100 export BEA_JAVA_HOME
101
102 DEFAULT_BEA_JAVA_HOME=""
103 export DEFAULT_BEA_JAVA_HOME
104
105 SUN_JAVA_HOME="/u02/JAVA/latest"
106 export SUN_JAVA_HOME
107
108 DEFAULT_SUN_JAVA_HOME="/u02/JAVA/latest"
109 export DEFAULT_SUN_JAVA_HOME
110
111 ACC_HOME="/u01/app/oracle/Middleware/ohs"
112 export ACC_HOME
113
114
115 if [ "${SUN_JAVA_HOME}" = "" ] ; then
116         SUN_JAVA_HOME="@DEFAULT_SUN_JAVA_HOME"
117         export SUN_JAVA_HOME
118 fi
119
120 if [ "${BEA_JAVA_HOME}" = "" ] ; then
121         BEA_JAVA_HOME="@DEFAULT_BEA_JAVA_HOME"
122         export BEA_JAVA_HOME
123 fi
124
125 if [ "${VM_TYPE}" = "JRockit" ] ; then
126         JAVA_HOME="${BEA_JAVA_HOME}"
127         export JAVA_HOME
128 else
129         if [ "${JAVA_VENDOR}" = "Sun" ] ; then
130                 JAVA_HOME="${SUN_JAVA_HOME}"
131                 export JAVA_HOME
132         else
133                 JAVA_VENDOR="Oracle"
134                 export JAVA_VENDOR
135                 JAVA_HOME="/u02/JAVA/latest"
136                 export JAVA_HOME
137                 VM_TYPE="HotSpot"
138                 export VM_TYPE
139         fi
140 fi
        


5.3:-
Edit JAVA_HOME into setNMJavaHome.sh

[oracle@RDbsGurus bin]$ cd
$MW_HOME/user_projects/domains/base_domain/bin
[oracle@DbsGurus bin]$ vi setNMJavaHome.sh

 6 # *************************************************************************
  7 #  This script is used to JAVA_HOME for NodeManager.
  8 # *************************************************************************
  9
 10 BEA_JAVA_HOME=""
 11 export BEA_JAVA_HOME
 12
 13 DEFAULT_BEA_JAVA_HOME=""
 14 export DEFAULT_BEA_JAVA_HOME
 15
 16 SUN_JAVA_HOME="/u02/JAVA/latest"
 17 export SUN_JAVA_HOME
 18
 19 DEFAULT_SUN_JAVA_HOME="/u02/JAVA/latest"
 20 export DEFAULT_SUN_JAVA_HOME
 21
 22 if [ "${VM_TYPE}" = "JRockit" ] ; then
 23         JAVA_HOME="${BEA_JAVA_HOME}"
 24 else
 25         if [ "${JAVA_VENDOR}" = "Sun" ] ; then
 26                 JAVA_HOME="${SUN_JAVA_HOME}"
 27         else
 28                 JAVA_VENDOR="Oracle"
 29                 export JAVA_VENDOR
 30                 JAVA_HOME="/u02/JAVA/latest"
 31                 VM_TYPE="HotSpot"
 32         fi
 33 fi
 34
 35 JAVA_HOME="${JAVA_HOME}"
 36 export JAVA_HOME


Step6:-
Restart WebLogic Services.

we need to bounce WebLogic services so that the above JAVA version changes applied successfully.


6.1:- Stopped node manager and Weblogic process

[oracle@DBGURU bin]$cd /u01/app/oracle/Middleware/user_projects/domains/base_domain/bin
 
[oracle@DBGURU bin]$ pwd
/u01/app/oracle/Middleware/user_projects/domains/base_domain/bin
 
[oracle@DBGURU bin]$ ./stopNodeManager.sh
<2020-07-15 EDT 13:22:17>
<2020-07-15 EDT 13:22:17>
<2020-07-15 EDT 13:22:17>
<2020-07-15 EDT 13:22:17>
<2020-07-15 EDT 13:22:17>
<2020-07-15 EDT 13:22:17>
<2020-07-15 EDT 13:22:18>
/u01/app/oracle/Middleware/user_projects/domains/base_domain/nodemanager/stopnodemanager.log was copied to /u01/app/oracle/Middleware/user_projects/domains/base_domain/nodemanager/nodemanager.log
 
[oracle@DBGURU bin]$ ./stopWebLogic.sh
Stopping Weblogic Server…
Initializing WebLogic Scripting Tool (WLST) …
Jython scans all the jar files it can find at first startup. Depending on the system, this process may take a few minutes to complete, and WLST may not return a prompt right away.
Exiting WebLogic Scripting Tool.
WLST lost connection to the WebLogic Server that you were connected to.
This may happen if the server was shut down or partitioned.
You will have to re-connect to the server once the server is available.
Disconnected from weblogic server:
Done
Stopping Derby Server…
Derby server stopped.


6.2:- Start Weblogic services

[oracle@DBGURU 30965714]$ cd /u01/app/oracle/Middleware/user_projects/domains/base_domain/bin
 
[oracle@DBGURU bin]$ nohup sh startWebLogic.sh>startWebLogic.log 2>&1&
[1] 72617
 
[oracle@DBGURU bin]$ nohup sh startNodeManager.sh > startNodeManager.log 2>&1&


Step7:- Validate Java version

[Oracle@DBsGURU ~]$ which java
/u02/java/latest/bin/java
[Oracle@DBsGURU ~]$ java -version
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)

This document is only for learning purpose and always validate in the LAB environment first before applying in the LIVE environment.

Hope so you like this article!
Please share your valuable feedback/comments/subscribe and follow us below and don’t forget to click on the bell icon to get the latest update. Click here to know more about our pursuit.

Loading

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

DBsGuru

Hello and welcome to DBsGuru,DBsGuru is a group of experienced DBA professionals and serves databases and their related community by providing technical blogs, projects, training. Technical blogs are the source of vast information not about databases but its related product like middleware, PL/SQL, replication methodology, and so on.Thanks for the visits!Share Learn Grow!