How to enable remote debugging in Intellij
Table of Contents
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
Click on Remote JVM 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.
Hello! I am Narayanaswamy founder and admin of narayanatutorial.com. I have been working in the IT industry for more than 12 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, Struts, Webservices, PHP, Oracle, MySQL, SQLServer, Web Hosting, Website Development, and IAM(ForgeRock) Specialist
I am a self-learner and passionate about training and writing. I am always trying my best to share my knowledge through my blog.