Monday, February 29, 2016

ESB Debugging Code ,Building and Do Patching

From this blog I will explain following.
  1. Debug the source code of ESB 4.9.0
  2. Apply a diff to ESB and build the code to do patching
  1. Debug ESB 4.9.0
  • Download the source code from https://github.com/wso2/wso2-synapse/tree/Apache-Synapse-2.1.3-wso2v11
  • Add the pom located in <CODE_BASE_490>/wso2-synapse-Apache-Synapse-2.1.3-wso2v11 to Intellij Idea
  • Navigate to Run-> Edit Configuration and add a new configuration by giving a name and a port (I have set up to 5008)
  • Then add debug points to code and you will be able to see the added  points by clicking view Breakpoints

  • Then start the ESB Server by ./wso2server.sh -debug 5008 and you will see "Listening for transport dt_socket at address: 5008 " in your terminal
  • Go to intellij and and click on green colour insect icon or Run-> Debug <your configuration name>
2.jpg

  • Once the first breakpoint reached it will stop so you can see how the code is running after the breakpoint by clicking F8. You can see what are values in variables etc.

  • You can navigate through by breakpoints by clicking green arrow (similar to play icon)Apply a diff to ESB and build the code to do patching.
     2. Apply a diff to ESB and build the code to do patching

  • Copy the diff you are having and paste to wso2-synapse-Apache-Synapse-2.1.3-wso2v11 from intellij (which is the root directory) 
  • Then right click on the uploaded .diff file and click Apply patch
  • If we made any changes inside the synapse core then go to <CODE_BASE_490>/wso2-synapse-Apache-Synapse-2.1.3-wso2v11 and run mvn clean install -Dmaven.test.skip=true
  • To reflect the changes you have done to code, you need to put the generated jar to the repository/components/patches folder inside the remote ESB. For that the newly build jar can be found at <CODE_BASE_490>/wso2-synapse-Apache-Synapse-2.1.3-wso2v11\modules\core\target
  • Copy the synapse-core-2.1.3-wso2v11.jar file to the patches directory in the ESB and rename it as the name inside the (mostly instead of - need to put _) repository/components/plugin folder(synapse-core_2.1.3.wso2v11.jar).
  • Restart the ESB to apply the patch.
Blogger Widgets