Thursday 17 May 2018

Remote Debugging in AEM 6.4

Namastey,

There are situations when you want to do debugging of OSGI java code while it is running on your AEM.

There are two parts to it : 

  1. AEM server should be enabled to accept remote debugging connection
  2. Eclipse IDE / Intellij should be configured to make remote debugging connection to AEM
Start AEM JAR with following command


java -Xmx2g -agentlib:jdwp=transport=dt_socket,address=5402,server=y,suspend=n -jar cq-author-p4502.jar 


-Xrunjdwp loads the JPDA reference implementation of JDWP
  • transport-dt_socket is the name of the transport to use in connecting to debugger
  • server=y  > means listen for a debugger application to attach
  • address=5402  > means listen for a connection at this address (no host = this port on add interfaces)
  • suspend=n  > means do not wait for a debugger to attach

Add Debug Configuration in Eclipse
  • click on debug configuration 
  • Select Remote Java Application
  • Add Configuration 
  • In the new configuration, select project and provide  aem host and aem port

Now setup some break points in java code ( except JSP)
Run your program and eclipse should ask you to enter debug mode.



Dhanywad

Basic Sling Model Exporter

/* Open a page which is having component /apps/project/components/page/page /content/project/en/jcr:content.model.json Don't miss...