Debugging an extension (SOE or SOI) can pose 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.
To debug your extension, you need to do the following:
- Use ArcGIS Server Manager to deploy your extension.
- Use Manager to enable debugging on your extension and configure debugging settings. These are described in more detail below.
- Set breakpoints at the desired locations in your extension code.
- Stop and then start the service.
- 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.
- 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:
- Log in to ArcGIS Server Manager and click Site.
- Click GIS Server > Extensions.
- Click Debug Settings and check Enable debugging of extensions. This enables the other options in the dialog box.
- 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.
- Optionally, specify a range of ports to be used when debugging.
- 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.