 {"id":295,"date":"2019-07-24T09:13:13","date_gmt":"2019-07-24T16:13:13","guid":{"rendered":"https:\/\/www.mavice.com\/blog\/?p=295"},"modified":"2020-09-01T18:12:07","modified_gmt":"2020-09-02T01:12:07","slug":"debugging-your-aem-6-4-application-in-intellij","status":"publish","type":"post","link":"https:\/\/www.mavice.com\/blog\/debugging-your-aem-6-4-application-in-intellij\/","title":{"rendered":"Debugging Your AEM 6.4 Application in IntelliJ"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" width=\"480\" height=\"480\" src=\"https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2020\/02\/IntelliJ_IDEA_Logo.svg_.png\" alt=\"\" class=\"wp-image-335\" srcset=\"https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2020\/02\/IntelliJ_IDEA_Logo.svg_.png 480w, https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2020\/02\/IntelliJ_IDEA_Logo.svg_-150x150.png 150w, https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2020\/02\/IntelliJ_IDEA_Logo.svg_-300x300.png 300w, https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2020\/02\/IntelliJ_IDEA_Logo.svg_-250x250.png 250w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/figure><\/div>\n\n\n\n<p>During development, debugging your application can be very useful in determining the location of defects, evaluating expressions and understanding the overall flow of the application. Your AEM application may consist of many Models, Services, or Servlets and you have the ability to set breakpoints in each.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>To debug your application, run the command below in your terminal to start AEM with the proper debug options set:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>java -XX:MaxPermSize=512m -Xmx2048M -agentlib:jdwp=transport=dt_socket,address=4502,server=y,suspend=n -jar ${PATH_TO_JAR} -p 4502<\/code><\/pre>\n\n\n\n<p>Next, open IntelliJ and create your debug configuration.<\/p>\n\n\n\n<ol><li>Click the Run Tab in the IntelliJ toolbar and select \u201cDebug\u201d<\/li><li>In the Debug Options Window, select Edit Configurations.<\/li><li>Add a new configuration by clicking the \u201c+\u201d in the top left hand corner.<\/li><\/ol>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" width=\"388\" height=\"65\" src=\"https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2019\/11\/intellij-debug-configurations.png\" alt=\"IntelliJ edit configurations dialog.\" class=\"wp-image-297\" srcset=\"https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2019\/11\/intellij-debug-configurations.png 388w, https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2019\/11\/intellij-debug-configurations-300x50.png 300w\" sizes=\"(max-width: 388px) 100vw, 388px\" \/><figcaption>IntelliJ Edit Configurations dialog.<\/figcaption><\/figure><\/div>\n\n\n\n<p>4. Select \u201cRemote\u201d and a new configuration will be added.<br>5. Select the new Configuration and edit the properties to match your AEM instance. <br>6. Add this command line to the \u201cCommand Line Arguments\u201d Section in your configuration.<\/p>\n\n\n\n<p>Address should be the port number your AEM instance is running on.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=4502<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" width=\"1024\" height=\"739\" src=\"https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2019\/11\/IntelliJ-Debug-New-Configuration-1024x739.png\" alt=\"IntelliJ New Configuration window\" class=\"wp-image-298\" srcset=\"https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2019\/11\/IntelliJ-Debug-New-Configuration-1024x739.png 1024w, https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2019\/11\/IntelliJ-Debug-New-Configuration-300x217.png 300w, https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2019\/11\/IntelliJ-Debug-New-Configuration-768x554.png 768w, https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2019\/11\/IntelliJ-Debug-New-Configuration-1040x751.png 1040w, https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2019\/11\/IntelliJ-Debug-New-Configuration-640x462.png 640w, https:\/\/www.mavice.com\/blog\/wp-content\/uploads\/2019\/11\/IntelliJ-Debug-New-Configuration.png 1132w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>IntelliJ Debug New Configuration window<\/figcaption><\/figure><\/div>\n\n\n\n<p>7. Click apply and then Debug. A new window should open with a message saying that you are Connected to the debugger.<\/p>\n\n\n\n<p>If\n you aren\u2019t able to connect, try restarting your AEM instance. The \ndebugger can only be connected after the AEM Instance is started.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>During development, debugging your application can be very useful in determining the location of defects, evaluating expressions and understanding the overall flow of the application.<\/p>\n","protected":false},"author":2,"featured_media":367,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[10,11,12,13],"_links":{"self":[{"href":"https:\/\/www.mavice.com\/blog\/wp-json\/wp\/v2\/posts\/295"}],"collection":[{"href":"https:\/\/www.mavice.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mavice.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mavice.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mavice.com\/blog\/wp-json\/wp\/v2\/comments?post=295"}],"version-history":[{"count":4,"href":"https:\/\/www.mavice.com\/blog\/wp-json\/wp\/v2\/posts\/295\/revisions"}],"predecessor-version":[{"id":376,"href":"https:\/\/www.mavice.com\/blog\/wp-json\/wp\/v2\/posts\/295\/revisions\/376"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mavice.com\/blog\/wp-json\/wp\/v2\/media\/367"}],"wp:attachment":[{"href":"https:\/\/www.mavice.com\/blog\/wp-json\/wp\/v2\/media?parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mavice.com\/blog\/wp-json\/wp\/v2\/categories?post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mavice.com\/blog\/wp-json\/wp\/v2\/tags?post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}