Debugging SOEs


Summary
This topic describes how to debug Java extensions at ArcGIS Server 10.1. The debugging workflow at 10.1 for server object extensions does not include a separate application to manage runtime debug settings. Instead, all debug management options are now available in ArcGIS Server Manager.

How to enable debugging
 
  1. Log into ArcGIS Server Manager.
  2. Ensure that the SOE you wish to debug into is deployed to ArcGIS Server.
  3. Publish a map service and enable the above SOE on it.
  1. 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 are init() and shutdown(). These methods are invoked by the parent map service during the startup and shutdown phases. When the map service starts, Server freezes initialization of the map service for the duration specified by this time window, thus allowing you to set a breaking point in init() or other lifecycle methods and connect the IDE debug session to the ArcGIS Server process hosting the SOE.
  2. Specify a port range. ArcGIS Server will select a port from this range, bind your map service and SOE’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 map service that your SOE is enabled on, for above changes to take effect.
How to debug into Java SOEs 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 15 Minutes”.
    4. Set the Source to “All”.
    5. Set the Machine to “All Machines”.
    6. Click “Update”.
    7. Pick up the port number from the log entry that mentions the name of the map service your SOE is enabled on and the name of your SOE. In the example below, the port number selected by ArcGIS Server is 9000:
  1. Switch to Eclipse.
  2. Right click your SOE class.
  3. Select “Debug As…”. Click Remote Java Application from list of types of applications.
  4. Select your SOE. If your SOE does not 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 SOE code, if not already set.
  4. Consume the SOE via its client application. The SOE 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 SOE's map service. Alternatively, just for duration of your debugging session, you could stop non-required services and reduce the number of instances of your SOE's map 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 SOE you debug into must be deployed on Server that is installed locally on the machine you are debugging SOE on.






Development licensing Deployment licensing
Server Server