Site icon Narayana Tutorial

How to enable remote debugging in Intellij

intellij

intellij

How to enable remote debugging in Intellij

Create web application and assign to application servers ( tomcat, weblogic websphere etc..) and then we can debug application by putting the break points in the application.

But the scenario is, in the IDE(Intellij) you build the war file and deployed it into remote application server and then its not possible to debug the application like as above.

So to achieve this one, we have to configure/enable the remote debug in the IntelliJ like as follows.

For Example:

Sample web application created in the intellij and the name is SampleApplication and build the war file in the intellij and then deployed into weblogic server and the URL is http://narayanatutorial.com/SampleApplication

 

Remote Debug Configuration – IntelliJ

 

Go to Run > Edit Configuration, then Run/Debug configuration screen to be opened.

Click on Add New Configuration

Intellij-add-new-configuration

 

Click on Remote JVM Debug

SampleApplication-Remote-Debug

 

Here the port 5005 and remote server debug port should be same.

 

Remote Server (Weblogic) Enable Debug

 

We need to start weblogic in the debug mode like as follows.

Create one .bat or .sh file according to environment wise, here I created .bat file and the file name is debug.bat in which we need to add the following line of commands.

@ECHO OFF

@REM WARNING: This file is created by the Configuration Wizard.
@REM Any changes to this script may be lost when adding extensions to this configuration.

SETLOCAL

set DOMAIN_HOME=C:\Weblogic\Middleware\Oracle_Home\user_projects\domains\test_domain
set JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=0.0.0.0:5005,server=y,suspend=n
call "%DOMAIN_HOME%\bin\startWebLogic.cmd" %*

ENDLOCAL

 

See here the port number 5005 enabled and common in the both configuration and also change the DOMAIN_HOME according to weblogic installation in your system.

Now stop the weblogic if already running and then double click on the above debug.bat file and then weblogic start in the debug mode.

 

Start Application in Debug mode – IntelliJ

After weblogic up and running, then come to IntelliJ, and start the application in the remote debug.

SampleApplication-Remote-Debug-Run