WebLogic Patch bsu getting java.lang.OutOfMemoryError

While applying WebLogic patch on Linux, its resulting in the following error on the command line:Exception in thread “Main Thread” java.lang.OutOfMemoryError

We were applying Bundle Patch 11g Release 1 (11.1.1.7.2) for Oracle Directory Server Enterprise Edition (ODSEE) 11g Release 1 (11.1.1.7.0) and (11.1.1.7.1) and during that it throws an exception.

The main reason for this issue is due to MEM_ARGS -Xms and -Xmx parameters are set to very low value.

How to resolve Exception in thread “Main Thread” java.lang.OutOfMemoryError?

Sometimes you can ignore this error because patch might be successfully applied but it throws an exception. And if you try to install for the second time it will show patch already installed. So please check the applied patch ID using below command.

 [oracle@orahow bsu]$ ./bsu.sh -install -patch_download_dir=/u01/app/Oracle/Middleware/utils/bsu/cache_dir -patchlist=MXLE -prod_dir=/u01/app/Oracle/Middleware/wlserver_10.3
Checking for conflicts…………
No conflict(s) detected
Installing Patch ID: MXLE..
Result: Success
Exception in thread "Main Thread" java.lang.OutOfMemoryError
[oracle@orahow bsu]$ ./bsu.sh -install -patch_download_dir=/u01/app/Oracle/Middleware/utils/bsu/cache_dir -patchlist=MXLE -prod_dir=/u01/app/Oracle/Middleware/wlserver_10.3
Patch already installed: MXLE

In case patch is not applied and its reflecting older patch ID then in that case you can increase the value of MEM_ARGS -Xms and -Xmx parameters inside the bsu.sh file located under cd $MW_HOME/utils/bsu as shown below.

cd /u01/app/Oracle/Middleware/utils/bsu
$ more bsu.sh
!/bin/sh
JAVA_HOME="/u01/app/jrockit-jdk1.6.0_31-R28.2.3-4.1.0"
MEM_ARGS="-Xms1024m -Xmx2048m"
"$JAVA_HOME/bin/java" ${MEM_ARGS} -jar patch-client.jar $*

Please take the backup of bsu.sh file and change the memory parameter as shown above and apply the patch again.