This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
WSO2 Patch Application Process
You apply patches to WSO2 products either as individual patches or through a service pack. A service pack is recommended when the number of patches increase. The following sections explain the WSO2 patch application process:
- Applying service packs to the Kernel
- Applying individual patches to the Kernel
- Verifying the patch application
- Overview of the patch application process
Before you begin
- You can download all WSO2 Carbon Kernel patches from here.
- Before you apply a patch, check itsÂ
README.txt
 file for any configuration changes required.
Applying service packs to the product
Carbon 4.2.0 Kernel supports service packs. A service pack is a collection of patches in a single pack. It contains two elements:
- TheÂ
lib
 directory: contains all the JARs relevant to the service pack. - TheÂ
servicepack_patches.txt
 text file: contains the list of JARs in the service pack.
Follow the steps below to apply service packs to your product.
- Copy the service pack file to the
<PRODUCT_HOME>/repository/components/servicepacks/
 directory. For example, the image below shows how a new service pack namedservicepack001
 is added to this directory. - Start your product. The following steps will be executed:
Before applying any patches, the process first creates a backup folder namedÂ
patch0000
 inside theÂ<PRODUCT_HOME>/repository/components/patches/
 directory, which will contain the original content of theÂ<PRODUCT_HOME>/repository/components/plugins/Â
directory. This step enables you to revert back to the previous state if something goes wrong during operations.- The latest service pack in theÂ
<PRODUCT_HOME>/repository/components/servicepacks/
 directory will be applied. That is, the patches in the service pack will be applied to theÂ<PRODUCT_HOME>/repository/components/plugins/
 directory. In addition to the service pack, if there are individual patches added to theÂ
<PRODUCT_HOME>/repository/components/patches/
 directory, those will also be incrementally applied to theÂplugins
 directory.ÂThe metadata file available in the service pack will maintain a list of the applied patches by service pack. Therefore, the metadata file information will be compared against theÂ
<PRODUCT_HOME>/repository/components/patches/
 directory, and only the patches that were not applied by the service pack will be incrementally applied to theÂplugins
 directory.Â
Applying individual patches to the product
You can apply each patch individually to your system as explained below. Alternatively, you can apply patches through service packs as explained above.
- Copy the patches to the
 <PRODUCT_HOME>/repository/components/patches/Â
directory. Start the Carbon server. The patches will then be incrementally applied to theÂ
plugins
 directory.Before applying any patches, the process first creates a backup folder namedÂ
patch0000
 inside theÂ<PRODUCT_HOME>/repository/components/patches/
 directory, which will contain the original content of theÂ<PRODUCT_HOME>/repository/components/plugins/Â
directory. This step enables you to revert back to the previous state if something goes wrong during operations.
Prior to Carbon 4.2.0, users were expected to apply patches by starting the server with wso2server.sh -DapplyPatches.
Now, you do not have to issue a special command to trigger the patch application process. It starts automatically if there are changes in either the  <PRODUCT_HOME>/repository/components/servicepacks/
 directory or the <PRODUCT_HOME>/repository/components/patches/
 directory. It verifies all the latest JARs in the servicepacks
 and patches
 directories against the JARs in the plugins
 directory by comparing MD5s of JARs.
Verifying the patch application
After the patch application process is completed, the patch verification process ensures that the latest service pack and other existing patches are correctly applied to the <PRODUCT_HOME>/repository/components/plugins/
 folder.
- All patch related logs are recorded in theÂ
<PRODUCT_HOME>/repository/logs/
 file.patches.log
- TheÂ
<PRODUCT_HOME>/repository/components/patches/.metadata/prePatchedJARs.txt
 meta file contains the list of patched JARs and the md5 values. A list of all the applied service packs and patches are in theÂ
<PRODUCT_HOME>/repository/components/default/configuration/prePatched.txt
 file.Do not change the data in the
<PRODUCT_HOME>/repository/components/default/configuration/prePatched.txt
file. The patch application process gets the pre-patched list from this file and compares the list with the patches available in theservicepack
andpatches
directories. If you change the data in this file, you will get a startup error when applying patches.
Overview of the patch application process
The diagram below shows how the patch application process is implemented when you start the server.