To debug a running Alfresco server, you must connect to the JVM in which Alfresco is running. The following steps configure the JVM to expose an interface for this connection, and then configure Eclipse to connect to and control that JVM.
Configuring the JVM
- Have a fully installed, configured, and running instance of Alfresco. These steps assume you are using Tomcat on Windows, but the steps are similar for other application servers on other systems.
- Have an IDE installed. These steps describe how to configure Eclipse, which must be installed first (Eclipse)
- Download and install the Alfresco source code from Alfresco source code.
- Ensure the source code is the same version as the installed Alfresco server.
- Verify that the Alfresco server is not running.
Edit the JVM options used to start the Alfresco Tomcat instance.
For example, set the following:
JAVA_OPTS=%JAVA_OPTS% -server -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8082where address is a port for your system.
- Save the file and close the editor.
- From the Run menu, choose the Open Debug dialog.
- Right-click Remote Java Application and select New.
- In the Name box, type Debug Local Tomcat Alfresco.
- Next to Project, click Browse, and select Web Client. If this is not available as an option, ensure your source code matches that of your server.
- In Connection Properties, enter the port number.
- Check Allow Termination of remote VM if you want to be able to stop the Alfresco server from the Eclipse console.
- Click Apply to save the configuration.