How to debug an AEM app using Eclipse
To debug an AEM application, you can use Java remote debugging.
Description description
Environment
- Adobe Experience Manager (AEM) 6.4
- Adobe Experience Manager (AEM) 6.5
Issues/Symptoms
How to debug an application running in a remote (or local) AEM server?
Resolution resolution
To debug an AEM application, you can use Java remote debugging.
Warning: Do not enable remote debugging in your production environment unless it necessary as it could greatly affect your application performance.
Step 1: Add the Remote Debugging JVM Parameter
To use remote debugging, you must start AEM with this JVM parameter:-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
You can add the parameter by doing any of the following:
- Add it to your
crx-quickstart/bin/start
scriptCQ_JVM_OPTS
environment variable (so your server always starts in debug mode). - Include it as a parameter when starting AEM with
java -jar
directly. For example,java -Xmx512m -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n -jar cq-author-4502.jar
Notes
- If necessary, you can change the port defined under “…,address=8000,…” from 8000 to something that works better in your environment.
- If you notice that it isn’t working, avoid forking the java process by specifying the -nofork command line option.
- The start script is located under crx-quickstart/bin
Step 2: Start a remote debugging session
To start a remote debugging session from Eclipse, do the following:
- Open Eclipse.
- Choose Run
>
Debug Configurations. - Right-click Remote Java Applications and select New.
- Select your AEM project under Project.
- Type in the port from the “address” configuration of the jvm parameter defined above. In the example, it is port 8000 (and the hostname of the machine you are connecting to, most likely localhost)
- To start a debugging session, double-click your new configuration in the Debug Configurations screen after saving it.
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f