Thursday, May 15, 2014

bsu.sh failed with a Null Pointer Exception


Problem
The bsu utility is not able to locate weblogic product installations directory. Due to this, while running bsu.sh in WebLogic Server 10.3.6, it failed with a Null Pointer Exception.


Error Message
$ ./bsu.sh -view -prod_dir=/u01/app/oracle/product/fmw/wlserver_10.3 -status=applied
Exception in thread "Thread-0" java.lang.NullPointerExceptionnull

        at com.bea.plateng.patch.PatchTargetHelper.loadPatchProfiles(PatchTargetHelper.java:447)
        at com.bea.plateng.patch.PatchTarget.<init>(PatchTarget.java:268)
        at com.bea.plateng.patch.PatchTargetFactory.create(PatchTargetFactory.java:30)
        at com.bea.plateng.patch.ProductAliasTarget.constructPatchTargetList(ProductAliasTarget.java:88)
        at com.bea.plateng.patch.ProductAliasTarget.<init>(ProductAliasTarget.java:46)
        at com.bea.plateng.patch.ProductAliasTargetHelper.getProdAliasTargetList(ProductAliasTargetHelper.java:55)
        at com.bea.plateng.patch.ProductAliasTargetHelper.getAllHomeToProdAliasesTargetMap(ProductAliasTargetHelper.java:32)
        at com.bea.plateng.patch.ProductAliasTargetHelper.checkProfilesInProductAliases(ProductAliasTargetHelper.java:133)
        at com.bea.plateng.patch.Patch$1.run(Patch.java:376)
        at java.lang.Thread.run(Thread.java:662)

$ ./bsu.sh -report
java.lang.NullPointerException
Exception in thread "Thread-0" java.lang.NullPointerException
        at java.io.File.<init>(File.java:222)
        at com.bea.plateng.patch.PatchBundleTarget.getItFromWeblogicServerProperties(PatchBundleTarget.java:378)
        at com.bea.plateng.patch.PatchBundleTarget.<init>(PatchBundleTarget.java:306)
        at com.bea.plateng.patch.PatchTargetFactory.create(PatchTargetFactory.java:39)
        at com.bea.plateng.patch.ProductAliasTarget.constructPatchTargetList(ProductAliasTarget.java:69)
        at com.bea.plateng.patch.ProductAliasTarget.<init>(ProductAliasTarget.java:46)
        at com.bea.plateng.patch.ProductAliasTargetHelper.getProdAliasTargetList(ProductAliasTargetHelper.java:55)
        at com.bea.plateng.patch.ProductAliasTargetHelper.getAllHomeToProdAliasesTargetMap(ProductAliasTargetHelper.java:32)
        at com.bea.plateng.patch.ProductAliasTargetHelper.checkProfilesInProductAliases(ProductAliasTargetHelper.java:133)
        at com.bea.plateng.patch.Patch$1.run(Patch.java:376)
        at java.lang.Thread.run(Thread.java:662)

Cause
  • When there is an invalid weblogic product installation directory path present in the beahomelist file.
  • If the  beahomelist file is corrupted

Solution
If the bsu.sh throws the NullPointerException then perform the following steps:

  1. Rename the existing beahomelist.  Create a new beahomelist with just one entry of the current weblogic product installation directory path that is being used and try to run the bsu.sh
  2. If it fails, rename the beahomelist and launch the bsu in gui mode. You will get  Error prompt as "Unable to locate any supported product installations. Click OK to locate a BEA Home with valid target installations". See the below screenshot for the same.
 



Then click OK, and in the next prompt choose the BEA Home directory. Then it will create a new beahomelist file. Now run the bsu.sh to apply, view or remove the WebLogic patches

In Windows the beahomelist file is present under the ${SystemDrive}\bea folder
Ex: c:\bea

For Linux and UNIX - the beahomelist file is located under the ${HOME}/bea folder.
Ex:/home/<app user id>/bea

$ cat beahomelist
/u01/app/oracle/product/fmw

Once the above work around is done verify by executing the below command to ensure bsu.sh is working fine

$ cd /u01/app/oracle/product/fmw/utils/bsu/
$ ./bsu.sh -prod_dir=/u01/app/oracle/product/fmw/wlserver_10.3 -view -status=applied
ProductName:       WebLogic Server
ProductVersion:    10.3 MP6
Components:        WebLogic Server/Core Application Server,WebLogic Server/Admi
                   nistration Console,WebLogic Server/Configuration Wizard and
                   Upgrade Framework,WebLogic Server/Web 2.0 HTTP Pub-Sub Serve
                   r,WebLogic Server/WebLogic SCA,WebLogic Server/WebLogic JDBC
                    Drivers,WebLogic Server/Third Party JDBC Drivers,WebLogic S
                   erver/WebLogic Server Clients,WebLogic Server/WebLogic Web S
                   erver Plugins,WebLogic Server/UDDI and Xquery Support,WebLog
                   ic Server/Evaluation Database,WebLogic Server/Workshop Code
                   Completion Support
BEAHome:           /u01/app/oracle/product/fmw
ProductHome:       /u01/app/oracle/product/fmw/wlserver_10.3
PatchSystemDir:    /u01/app/oracle/product/fmw/utils/bsu
PatchDir:          /u01/app/oracle/product/fmw/patch_wls1036
Profile:           Default
DownloadDir:       /u01/app/oracle/product/fmw/utils/bsu/cache_dir
JavaVersion:       1.6.0_29
JavaVendor:        Sun