12

Can someone please run through the steps that you need to follow to apply .patch files onto WSO2 ESB v4.0.3? I've tried the following:

  1. Upload .patch file to repository/components/patches and carbon_home/lib/patches

  2. Run wso2server.sh start -DapplyPatches

This command creates a dir called patch000 in the components/patches directory and fills it with plugins.

The patch I want to apply is https://issues.apache.org/jira/browse/TRANSPORTS-51

Many thanks

tk_
  • 16,415
  • 8
  • 80
  • 90
ourweehome
  • 163
  • 2
  • 5

4 Answers4

10

You need to apply .patch file to the code base and create jar(s) out of it. Then Create a folder with the name of the patch (eg: patch001) and place the jar(s) inside and copy newly created patch folder (eg: patch001) to repository/components/patches. Now running the wso2server.sh -DapplyPatches will work.

when you execute -DapplyPatches, it takes a backup of the original content of the repository/components/plugins directory to repository/components/patches directory that's why you see patch000 folder (hence revert-back to a previous state is possible).

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Thilini Ishaka
  • 953
  • 1
  • 8
  • 13
  • I have to apply a patch to ESB-4.6.0. The source is available for download? And there's some tutorial explaining how to generate the jar? Thanks. – elias Mar 14 '14 at 14:03
3

From carbon 4.2.0 onwards you don't need to provide -DapplyPatches option in order to apply the patch. When a server started up it automatically detects and apply if there are new patches. This can be verified from the log file repository/logs/patches.log

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Sajith
  • 91
  • 1
  • 4
3

WSO2 Official patch,

  1. Read the readme file.(not a must step, better if you do)

  2. Shutdown the server, if you have already started.

  3. Copy the wso2carbon-version.txt file to /bin.(not a must step,better if you do)

  4. Copy the patchNumber to /repository/components/patches/

  5. Restart the server with : Linux/Unix : sh wso2server.sh Windows : wso2server.bat

Patch Created by you

Compile(mvn clean install) and get the jar from the modified code base. for example, let's say you are creating a patch for carbon-registry extensions. First, clone the carbon-registry and do the fix then go to the extensions module. Using maven build(mvn clean install) the jar. Then Create a folder with the name of the patch (eg: patch9999) and place the jar(s) inside and copy newly created patch folder (eg: patch9999) to repository/components/patches. Now simply restart/start the product and the patch will get applied.

./wso2server.sh restart/start

However, if the product is older than carbon 4.2.0 you have to provide -DapplyPatches attribute when starting the product like below.

./wso2server.sh -DapplyPatches

if the patch gets applied successfully you can see below set of lines in the beginning.

[2016-08-24 20:27:25,319]  INFO {org.wso2.carbon.server.extensions.PatchInstaller} -  Patch changes detected 
[2016-08-24 20:27:27,980]  INFO {org.wso2.carbon.server.util.PatchUtils.console} -  Backed up plugins to patch0000
[2016-08-24 20:27:28,010]  INFO {org.wso2.carbon.server.util.PatchUtils.console} -  Patch verification started
[2016-08-24 20:27:28,034]  INFO {org.wso2.carbon.server.util.PatchUtils.console} -  Patch verification successfully completed.
tk_
  • 16,415
  • 8
  • 80
  • 90
  • Very good first point! Because there are patches that must be applied manually - described then in the readme file! – Philipp Jun 15 '15 at 12:21
-1

As Sajith says, we have added -DapplyPatches as JVM parameter by default in wso2server.sh file.

Harsha
  • 216
  • 1
  • 7