Debugging Workflow Rule Services
Debugging Workflow Rule Services
When developing business logic, you will often need to troubleshoot or debug your workflow rule services. This topic describes several techniques that you can use to debug your services.
Use the Archibus Log File
The Archibus log file ( \WEB-INF\config\archibus.log ) contains information that can be very useful for troubleshooting configuration and programming issues. This includes:
- Archibus software version and build number.
- Application server version.
- Database JDBC driver version.
- Software configuration parameters, such as web application path and maximum JVM heap size.
- Log of the user authentication actions.
- Runtime errors.
Web Central forms will display the error message dialog if any error happens in a service. This message will display only a short description of the error. The file will contain the full error details, including:
- The name and input parameters of the workflow rule.
- The detailed error message that identifies the root of the error.
- The complete Java call stack that identifies the place in the Java code where the error happened.
Use Debug Mode
In order to effectively troubleshoot services you should turn on the debug mode. This enables debug-level logging for services and core Java classes, producing additional debugging information in the WEB-INF\config\archibus.log file. It also turns off the Java Script compression mode so that you can easily debug the Java Script code in the browser.
-
Open the
WEB-INF\config\core.properties
file. -
Change the value of the
debug
property to
true
:
-
You can also turn off the login page, so that you can test any view without going through the Web Central sign-in process. To do so, edit the
autoLogin
value in the
login.properties
file. - The new setting will be used the next time you start Web Central, or a unit test.
Check Workflow Rule Inputs and Response Using Firebug
You can see the workflow rule inputs and response if you are using Firefox browser with Firebug extension. This extension is also a powerful HTML, CSS, and Java Script debugging tool, so you should make it a part of your development environment.
- Download and install Firefox from www.mozilla.com/firefox/ .
- Open Firefox browser and navigate to http://getfirebug.com/ . Click on the Install Firebug 1.3 for Firefox button and follow the instructions.
- Navigate to any Web Central view.
- Click on the Firebug icon (a bug ) in the bottom right corner of the Firefox browser window. The Firebug Console panel will open.
-
Click on the button that calls the workflow rule. The Firebug Console will display the POST entry for each workflow rule invocation:
-
Expand the POST entry in the Firebug Console to see the request parameters and the response data:
Debug Service Code
If the information in the file and the request/response data displayed in Firebug is not sufficient to resolve the problem, you need to debug the service Java code in Eclipse.
- Open the service Java class in Eclipse editor.
- Select the service method that you want to debug.
-
Double-click on the source code line where you want to start debugging. Eclipse will display the breakpoint icon to the left of the source code:
- Start Web Central Jetty server in debugging mode:
-
Select the
webcentral-all-Jetty.launch
file in the Package Explorer window. - Select in the main menu: Run --> Debug As... -> webcentral-all-Jetty .
- Jetty server will start in debugging mode and Eclipse will display the startup message in the Console window.
- Navigate to the view that uses this workflow rule, and click on the button that calls it.
-
Eclipse will stop the service execution at the breakpoint:
-
You can now use Eclipse debugger to:
- Examine method parameters and local variables in the Variables panel.
- Execute the current method code step-by-step using the Run -- Step Over menu option (also on the Debug panel toolbar).
- Step inside another method code using the Run -- Step Into menu option (also on the Debug panel toolbar).
- Resume the program execution using the Run -- Resume menu option (also on the Debug panel toolbar).
- While you are using Eclipse debugger, the view Java Script code that calls the workflow rule will likely time-out. This does not affect the Java code execution.