How to debug a custom geoprocessing tool published as service to ArcGIS Server 10.1

This topic describes how to debug a Java geoprocessing tool that is published as GP service at ArcGIS Server 10.1. The debugging workflow at 10.1 for Java extensions does not include a Java Configuration Tool (JCT) to manage runtime debug settings. Instead, all debug management options are now available in ArcGIS Server Manager.
To find out how to debug a geoprocessing tool in ArcGIS Engine or Desktop, read the "Debugging Extensions in Engine and Desktop" topic.

How to enable debugging
  1. Log into ArcGIS Server Manager.
  2. Ensure that the geoprocessing tool you wish to debug into is deployed to ArcGIS Server as a GP service.
  3. Navigate to Site -> Extensions. Click the “Debug Settings” button.
  1. Click “Enable debugging of extensions” to enable debugging.
  1. Check the “Suspend service startup” checkbox and provide a time window in milliseconds if you wish to debug into the lifecycle methods of your extension. Examples of lifecycle methods for geoprocessing tools are function factory methods as well as those defined in the tool's Java class such as getName(), getDisplayName(), getParameterInfo(), etc. These methods are invoked by Server during the startup and tool access and execution phases. When the geoprocessing service starts, Server freezes initialization of the geoprocessing service for the duration specified by this time window, thus allowing you to set a breaking point in the lifecycle methods and connect the IDE debug session to the ArcGIS Server process hosting the geoprocessing service.
  2. Specify a port range. ArcGIS Server will select a port from this range, bind your map service and geoprocessing service’s process to the next available port from this range, and listen to the incoming connection request on this port.
  3. Click “Save”. Debugging is now enabled on ArcGIS Server.
  4. Restart the geoprocessing service for above changes to take effect.
How to debug into Java geoprocessing tools using Eclipse IDE
  1. Determine the port number that ArcGIS Server is listening on, as follows:
    1. Access the server logs in ArcGIS Server Manager.
    2. Set the Log Filter to “Verbose” level.
    3. Set the Age to “Last Hour” or "Last 15 m.
    4. Set the Source to “All”.
    5. Set the Machine to “All Machines”.
    6. Click “Query”.
    7. Pick up the port number from the log entry that mentions the name of the geoprocessing service. In the example below, the port number selected by ArcGIS Server is 9003:
  1. Switch to Eclipse.
  2. Right click your geoprocessing tool class.
  3. Select “Debug As…”. Click Remote Java Application from list of types of applications.
  4. Select the geoprocessing tool class. If the tool does not already show up as an item in the “Remote Java Application” list, create a new launch configuration within this type.
  1. In the Port text box, type in the port number copied from ArcGIS Server Manager.
  2. Click Debug.
  3. Set breakpoints in your geoprocessing tool code, if not already set.
  4. Invoke the tool via a REST (Services Directory) SOAP API. The tool execution on ArcGIS Server will stop at the breakpoint you set in Eclipse.
How to disable debugging
  1. Log into ArcGIS Server Manager.
  2. Navigate to Site -> Extensions. Click the “Debug Settings” button.
  1. Uncheck the “Enable debugging of extensions” check-box to disable debugging.
  1. Click “Save”. Debugging is now disabled on ArcGIS Server.
  2. Restart the map service that your SOE is enabled on, for above changes to take effect
Some tips
  • Before turning debugging on, open the "Logs" page in Manager and verify that the log level in "Settings" section is set to Verbose. Setting log level to Verbose will ensure that logs will be generated at this level.
  • After debugging is turned on in Manager, Server allocates a port number to all instances of services that are newly created or re-started. If you have numerous services running, then you must provide a wider port range in the Site -> Extensions -> Debug Settings dialog in Manager to accommodate all those instances, including those of your geoprocessing service. Alternatively, just for duration of your debugging session, you could stop non-required services and reduce the number of instances of your geoprocessing service to one. This will allow for a shorter port range, and will generate less number of logs for you to sift through to determine the port number. Please remember to restart those other services once debugging session is over.
  • Remember to turn debugging off in the Site -> Extensions -> Debug Settings dialog in Manager, after your debugging session is over.
  • The geoprocessing service you wish to debug into must be deployed on Server that is installed locally on the machine you are debugging on.

Development licensingDeployment licensing