When developing add-ins, fixing bugs, or changing SkyVault
from the source code, it is helpful to debug an instance of SkyVault
running on a standard application server. This section outlines the steps
needed to configure SkyVault
and Eclipse to provide a real-time view of the server and to troubleshoot
issues by stepping through the code line by line.
To debug a running SkyVault server, you must connect to the JVM in which SkyVault 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
This task describes how to configure the JVM to expose an
interface for connection to the SkyVault
server.
Before you start, you must:
- Have a fully installed, configured, and running instance of SkyVault. 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 (http://www.eclipse.org/downloads)
- Download and install the SkyVault source code from http://wiki.alfresco.com/wiki/Alfresco_SVN_Development_Environment.
- Ensure the source code is the same version as the installed SkyVault server.
- Verify the SkyVault server is not running.
-
Edit the JVM options used to start the SkyVault Tomcat instance.
For example, set the following:
JAVA_OPTS=%JAVA_OPTS% -server -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8082
where address is a port for your system. - Save the file and close the editor.
Configuring Eclipse
This task describes how to configure Eclipse to connect to and
control the JVM.
- 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 SkyVault.
- 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 SkyVault server from the Eclipse console.
- Click Apply to save the configuration.
You have configured SkyVault
and Eclipse. Next, you can start the SkyVault
server and start the Debug configuration in Eclipse. Eclipse will
connect to the SkyVault
JVM. From the Java perspective in Eclipse, you can expand the
"core" or "web client" packages, open the class files you are
interested in, and set breakpoints for the SkyVault
server to stop at. From the Debug perspective, you can then interrogate
specific variables from the SkyVault
server "live", and step through the source code line by
line.