Debugging OSGi Java Code in AEM: A Simple Guide
Debugging OSGi Java Code in AEM: A Simple Guide
Steps to Debug OSGi Code in AEM
-
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. -
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.
-
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.
-
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.
-
Control Code Execution
- Use
F6
(Step Over) to go through your code line by line.
Comments
Post a Comment