Saturday, October 19, 2013

[Alfresco] How to Remote Debug an Alfresco Windows Service in Eclipse

This article refers to Tomcat 6 and Alfresco 3.4.0

Problem:

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?

Solution:

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):

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

Enjoy!

No comments:

Post a Comment