Posts Tagged ‘Tomcat’

How to Remote Debug an Alfresco Windows Service in Eclipse

1 Comment »

This article refers to Tomcat 6 and Alfresco 3.4.0


So you have the Alfresco system installed on the Microsoft Windows platform and it is installed as a service. You have trawled the web for hours trying to figure out how to enable remote debugging from Eclipse. A lot of sites talk about changing the Tomcat configuration and you’ve tried modifying all the .bat files in the tomcat/bin folder within your Alfresco installation and nothing works?


This problem is compounded by lots of conflicting information on the web with some resolution methods to be used on a UNIX install rather than Windows or with the Windows version when it is not installed as a service.  You may have seen the following argument string to be included in the Tomcat configuration mentioned but don’t know where to put it?

-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

The answer, it turns out, is not so easy to find. Essentially you need to configure the “alfrescoTomcat” service by doing the following:

1.  Open a Command Prompt (START –> Run –> cmd).
2.  Change to the “tomcat\bin” folder (e.g. cd c:\alfresco\tomcat\bin).
3.  Enter the command tomcat6w.exe //ES//alfrescoTomcat which launches the service configuration dialog box. Note that if you try to run the executable by double-clicking it you will get the following error message:

The specified service does not exist as an installed service.

4. Click on the JAVA tab and enter the following text at the bottom of the “Java Options” field as per the below screenshot (note that that line break is significant):


Alfresco Service Config

Alfresco service dialog box.

5.  Close the dialog box and restart Tomcat. The easiest way to do this is to restart the Alfresco service from the Start menu (i.e. START –> Alfresco Community –> Alfresco Community Service).

You should now be able to connect to Tomcat from Eclipse by doing the following:

1.  Open Eclipse.
2.  Select “Debug Configurations…” from the “Run” pull-down menu.
3.  Double-click “Remote Java Application” to create a “New_configuration” profile.
4.  On the “Connect” tab, browse to the project you want to debug.
5.  Change the “Port” in “Connection Properties” to 8000.
6.  Leave all the rest at the defaults and click the “Debug” button to start debugging!