Wednesday, November 21, 2012

Remote Debugging - Liferay/Eclipse

Remote debugging is very useful feature that we can rely to troubleshoot issues. Please follow the below steps to enable remote debugging on Liferay server.

>> Double click on the Liferay server in eclipse
Add the following configuration at the end of Liferay settings -> Memory args
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n



This will open the tomcat server in debug mode at port 8000.

>> Now open the debug configurations in eclipse and select "Remote Java Application"
>> Right click and click on "New". This will open up below dialog.


>> Use browse and select the project that you want to debug.  Change the Host and Port accordingly. Since I opened tomcat in debug mode under port 8000, I leave it as is. If you open tomcat in debug under different   port, update here with same. Also update the Host if the Liferay server is running at different location(host).
>> (This step is optional) Now go to common tab and check the Debug option under "Display in favorites menu"). Accept the other defaults and click on "Apply".
>> Now go back to the project and open the java source file where you want to debug the code. Now double click on the line to add the breakpoint.
>> Start the liferay server. Go to debug icon now select the project and click on it
>> Navigate thru the application and eclipse will stop at the break point you set in the java file. That's it.

No comments:

Post a Comment