Debugging is one of the most common techniques used by developers to find and fix errors in their code. Today, from this article we will discuss how to debug WSO2 products using the IntelliJ IDE.
In this tutorial, we will be using wso2/product-is as an example. You can clone or download the wso2/product-is from this GitHub link.
There are a few steps to this. Let’s go through them one by one 😊.
1️⃣Setup the debug configuration
First, open the product-is repository that you cloned or downloaded from IntelliJ.
Then open Run/Debug Configurations (This can be done in several ways, one method is to select Run | Edit Configurations from the main menu or we can use the Edit Configurations from the run/debug configuration selector).
After that, as shown in the image click on the + icon in the top left and select Remote JVM Debug.
Then add a name you like also if you want you can change the port number as well 😉.
Finally, press OK to save the configuration.
Now we have successfully set up the debug configuration in IntelliJ IDE. Then let’s see how we can use this configuration.
2️⃣Debugging the product
First, we have to open a terminal window (a cmd interface) in the <PRODUCT-IS>/bin folder location (<PRODUCT-IS> is the folder location of the product-is project).
Then simply type
- If you are a Linux/macOS user
sh wso2server.sh -debug 5005
- If you are a windows user
wso2server.bat -debug 5005
Replace 5005 with the port number that you used when you were creating the debug configuration.
After that go to the IDE and select the configuration you created from the run/debug configuration selector as shown below.
And THAT’S IT 🥳. See, it is not that difficult 😄.
Also if you want to know more about debugging WSO2 products you can follow this article as well 😊👇.
This is the end of the article. Before I finish I want to say, if I have made any mistakes or if there is an easy way to do this please add a comment below about it. If you find this article useful, feel free to share this with your friends and colleagues.
Thank you and HAPPY CODING! 👋🧑💻👩💻👨💻