May 12, 2020
Estimated Post Reading Time ~

Debugging in AEM on Remote

To access the complete flow of a CQ running on a remote server, First We need to start our CQ instance in debug mode.

Step 1: Add the Remote Debugging JVM Parameter

  1. To use remote debugging, you must start CQ5 with this JVM parameter:
    -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
You can add the parameter by doing the following;
  1. Start your server like this: crx-quickstart/bin/start -d --debug-port 8000. The -d parameter adds the jvm parameter to the CQ5 java process.
  2. Add it to your crx-quickstart/bin/start script CQ_JVM_OPTS environment variable (so your server always starts in debug mode).
  3. Include it as a parameter when starting CQ5 with java -jar directly. For example, java -Xmx512m -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n -jar cq-author-4502.jar
Another Version of the command is :
java -jar cq5-author-4502.jar -fork -forkargs -- -Xdebug -Xrunjdwp:transport=dt_socket,address=59865,suspend=n,server=y -Xmx1520m -XX:MaxPermSize=512m -XX:-UseSplitVerifier
Notes
  • If necessary, you can change the port defined under “…,address=8000,…” from 8000 to something that works better in your environment.
  • Starting CQ 5.5, using the last solution, when Quickstart forks a new process it does not start the JVM with the debug options. You can prevent forking by specifying the -nofork command line option.
  • Te start script is located under crx-quickstart/server for CQ versions < 5.5

Step 2: Start a remote debugging session

To start a remote debugging session from Eclipse, do the following:
  1. Open Eclipse.
  2. Choose Run > Debug Configurations.
  3. Right-click Remote Java Applications and select New.
  4. Select your CQ5 project under Project.
  5. Type in the port from the “address” configuration of the jvm parameter defined above. In the example, it is port 8000 (and the host name of the machine you are connecting to, most likely localhost)
  6. To start a debugging session, double-click your new configuration in the Debug Configurations screen after saving it.
Applies to:  CQ 5.x and Adobe Experience Manager 6.x
Troubleshooting :
1. While starting the AEM instance, make sure JVM has enough heap size for running CQ server, otherwise it will fork the JVM and parameters will not be passed to the forked jvm. Use -fork -forkargs – option to ensure that the command line parameters gets passed to the jvm.
2. If you are using java 7 , make sure to specify the -XX:-UseSplitVerifier parameter to avoid the unwanted strict verification errors while debugging the bundle.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.