Skip To Content

Debug an extension

Debugging an extension (SOE or SOI) poses certain challenges, because you must step into a running service process. ArcGIS Server Manager offers several settings that can help you debug Java extensions. These settings are described in more detail below. The process of debugging extensions is the same regardless of which SDK you are using to develop your SOE or SOI.

Debugging workflow

To debug your extension, you need to do the following:

  1. Use ArcGIS Server Manager to deploy your extension.
  2. Use Manager to enable debugging on your extension and configure debugging settings. These are described in more detail below.
  3. Set breakpoints at the desired locations in your extension code.
  4. Stop and then start the service.
  5. Immediately attach your debugger to the operating system process running the service. If your breakpoint is in the extension initialization code, the breakpoint will be hit as the service starts. Otherwise, the breakpoint will be hit when you use the extension.
  6. Use Manager to disable debugging.

Configuring debugging settings in Manager

To facilitate debugging, ArcGIS Server Manager allows you to alter extension behavior. You can suspend the service startup so that you can attach your debugger to the service process before the extension initialization methods are called. You can also specify a range of ports that will be used when debugging the service.

To access these debugging settings in Manager, follow these steps:

  1. Log in to ArcGIS Server Manager and click Site.
  2. Click GIS Server > Extensions.
  3. Click Debug Settings and check Enable debugging of extensions. This enables the other options in the dialog box.
  4. Optionally, check Suspend service startup and enter the number of seconds that the service startup should be delayed.

    Some extension code only runs one time, when the service starts. This code is typically placed in the Construct method of the IObjectConstruct interface. Suspending the service startup gives you time to attach your debugger to the service process before the Construct method runs, thereby allowing you to hit any breakpoints you have set in that method's code.

  5. Optionally, specify a range of ports to be used when debugging.
  6. Click Save.

Now you can debug your extension by stopping and then starting the service and attaching your debugger to the operating system process running your service. If you set a time window for suspending service startup, you need to attach your debugger to the service process before this window is reached; otherwise, you will not hit any breakpoints in the extension's Construct method.

You can stop and start the service as many times as needed during the debugging process.

Caution:

When you have finished debugging your extension, return to the debug settings and uncheck Enable debugging of extensions. If you fail to do this and you had configured your settings to suspend the service startup, you will experience a delay each time you try to start your service.