avatar
Debug Your AEM Application in IntelliJ Tool

• First, we don't strongly recommend using IntelliJ for debugging AEM applications. You can also use other tools if you prefer.

We'll opt for Remote JVM Debug and configure a specific port, such as 8000, to make debugging on the AEM site possible, as the following here.

• Next, you will need to terminate any applications that are using port 8000 using the following commands:

netstat -ano | findstr "8000"
taskkill /F /PID <pid>

• Continuing with the folder structure below, we will need to create two start-debug.bat files in both the 'author' and 'publish' directories.

~/aem-sdk
    /author
        + aem-author-p4502.jar
        + license.properties
        + start-debug.bat
        + crx-quickstart
        + publish
            + aem-publish-p4503.jar
            + start-debug.bat
            + crx-quickstart
    /publish
        + aem-publish-p4503.jar
        + license.properties
        + crx-quickstart 

» author/start-debug.bat

cd C:\aem-sdk\author
C:
java -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=512m -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n -jar aem-author-p4502.jar -v
pause

» author/publish/start-debug.bat

cd C:\aem-sdk\author\publish
C:
java -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=512m -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n -jar aem-publish-p4503.jar -v
pause

If you wish to configure a different port, other than 8000, you should make the necessary adjustments in the batch file and ensure that the Remote JVM Debug configuration uses the same port.

Finally, let us start the AEM instance by running the start-debug.bat file, rather than using the aem-author-p4502.jar or aem-publish-p4503.jar files.

At the same time, we need to enable AEM Debug (Remote JVM Debug) in IntelliJ to activate the debugging mode while running the AEM site.

You need to login to do this manipulation!