Debugging OSGi Java Code in AEM: A Simple Guide

Debugging OSGi Java Code in AEM

Debugging OSGi Java Code in AEM: A Simple Guide

Steps to Debug OSGi Code in AEM

  1. Start AEM in Debug Mode
    java -Xmx2g -agentlib:jdwp=transport=dt_socket,address=5402,server=y,suspend=n -jar cq-author-p4502.jar -gui

    Note: Replace cq-author-p4502.jar with your specific jar file name. Ensure the port number (5402 in this example) matches the one you use.

  2. Set Up Eclipse for Remote Debugging

    - Open Eclipse and navigate to Debug Configurations by selecting Run -> Debug Configurations.

    - Choose Remote Java Application and click on New Launch Configuration.

  3. Configure Debug Settings

    - Enter a name for your configuration.

    - Set the Host to localhost (or your server’s IP address if remote).

    - Set the Port to 5402 (or the port number you specified when starting AEM).

    - Click Apply to save your settings.

  4. Set Breakpoints and Start Debugging

    - Open your Java code in Eclipse and set breakpoints where needed.

    - Click the Debug icon to launch your configuration.

    - Refresh your AEM page to trigger the breakpoint.

  5. Control Code Execution

    - Use F6 (Step Over) to go through your code line by line.

Comments

Popular posts from this blog

AEM show/hide enable/disable dialog fields based on Checkbox

AEM Caching with Google Guava: Use Case, Importance, and Implementation

Creating a Chrome Extension for Easy Redirection to Multiple AEM Instances