...
Table of Contents | ||
---|---|---|
|
...
This topic describes how to debug XperienCentral plugins using Eclipse. It is assumed that XperienCentral is up and running and that the plugin has been deployed.
...
- Create a new launch application in the Run > Debug Configurations panel by selecting "Remote Java Application" and clicking the upper left-hand button:
- Give it a meaningful name ans select the project associated with the plugin.
- Ensure that the rest of the settings (Host, localhost, Port), are correct:
During the start-up of XperienCentral Community Edition, Tomcat will also display this port in the console (dt_socket): - Ensure that the source files you want to debug are referenced in the "Source" tab of the created launch configuration. For example:
- When you click [Debug], Eclipse will make a connect to your Tomcat installation.
- Switch to the "Debub" perspective (Window > Open Perspective > Debug). You can now add breakpoints to your Java classes using the right mouse button. For example:
Using the buttons in the "Debug" perspective, you can now debug your plugin:
...
Hot Code Replacement
...
to Remotely Debug a Plugin
To allow Java code to be `hot replaced` while remote debugging from the Eclipse IDE, you need to add the following Java option to the start-up script of the Catalina server. This way you would not need to redeploy a plugin due to small changes in the Java code during debugging.
Inside the start-up script of Tomcat (e.g.
C:\GX\XperienCentral\apache-tomcat\bin\startup.bat
) replace the following line:set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
withset JAVA_OPTS=%JAVA_OPTS% -Xdebug -agentlib:jdwp=transport=dt_socket,address=localhost:8000,server=y,suspend=n
Restart Tomcat.
...
Remote Debugging with Java 9 and Higher
To remotely debug a plugin in Java 9 and higher, add the following to your Tomcat setenv.sh
script:
Code Block | ||
---|---|---|
| ||
CATALINA_OPTS="$CATALINA_OPTS -Xms512m -Xmx512m -verbosegc -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:8000 -Dcom.sun.management.jmxremote.port=9000 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" |