Debugging with Eclipse

In This Topic




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.

To debug a plugin in Eclipse, follow these steps:

  1. Create a new launch application in the Run > Debug Configurations panel by selecting "Remote Java Application" and clicking the upper left-hand button:




  2. Give it a meaningful name ans select the project associated with the plugin.
  3. 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):





  4. Ensure that the source files you want to debug are referenced in the "Source" tab of the created launch configuration. For example:






  5. When you click [Debug], Eclipse will make a connect to your Tomcat installation.
  6. 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:





Back to Top




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.

  1. 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

    with

    set JAVA_OPTS=%JAVA_OPTS% -Xdebug -agentlib:jdwp=transport=dt_socket,address=localhost:8000,server=y,suspend=n

  2. Restart Tomcat.



Back to Top



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:


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"



Back to Top