Copyright © 2006 Together Teamlösungen EDV-Dienstleistungen GmbH
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior written permission of the Together Teamlösungen EDV-Dienstleistungen GmbH.
Together Teamlösungen EDV-Dienstleistungen GmbH DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Table of Contents
One of the advantages of using an IDE for developing applications and components for Enhydra Server, is that the IDEs provide tools for debugging.
The Java development tools (JDT) are a set of extensions to the workbench that allow you to edit, compile, and run Java programs.
The JDT includes a debugger that enables you to detect and diagnose errors in your programs running either locally or remotely. The debugger allows you to control the execution of your program by setting breakpoints, suspending launched programs, stepping through your code, and examining the contents of variables.
The only requirement for debugging applications from Eclipse is that you must start the Enhydra (Enterprise) Server from your Eclipse project.
Before you debug an application, make sure you can run Enhydra Kelp project successfully. To do this, you will need to run the XML Compiler and the Kelp Deployer or Ant Rebuild Enhydra Tool.
A breakpoint causes the execution of a program thread to suspend at the location where the breakpoint is set.
Breakpoints can be enabled and disabled via their context menus in the Breakpoints view. When a breakpoint is enabled, it will cause a thread to suspend whenever the breakpoint is reached. Enabled breakpoints are indicated with a blue circle. Enabled breakpoints are shown with a checkmark overlay after their class is loaded by the VM and the breakpoint is successfully installed. When a breakpoint is disabled, it will not cause threads to suspend. Disabled breakpoints are indicated with a white circle. Breakpoints are displayed in the vertical editor ruler and in the Breakpoints view.
Line breakpoints are set on an executable line of a program. In the editor area, open the file where you want to add the breakpoint. Directly to the left of the line where you want to add the breakpoint, open the marker bar (vertical ruler) pop-up menu and select Toggle Breakpoint. You can also double-click on the marker bar next to the source code line. A new breakpoint marker appears on the marker bar, directly to the left of the line where you added the breakpoint. Also, the new breakpoint appears in the Breakpoints view list.
While the breakpoint is enabled, thread execution suspends before that line of code is executed. The debugger selects the thread that has suspended and displays the stack frames on that thread's stack. The line where the breakpoint was set is highlighted in the editor in the Debug perspective.
The Eclipse Java debugger has a client/server design so that it can be used to debug programs that run locally (on the same workstation as the debugger) or remotely (on another computer on the network). Local debugging is the simplest and most common kind of debugging. After you have finished editing and building your Enhydra Kelp project, you can launch the application (separate Enhydra Server instance) on your workstation using the Run > Debug... menu item on the workbench. Launching the application in this way will establish a connection between the debugger client and the Enhydra application that you are launching. You may then use breakpoints, stepping, or expression evaluation to debug your Enhydra application.
The simplest way to launch a Enhydra application is to run it using a 'Enhydra Application' launch configuration. This launch configuration type uses information derived from the workbench preferences and your Kelp project to launch the program. In the Package Explorer, select the Enhydra Kelp project (or one of its resources). From the pop-up menu, select 'Debug As > Debug'. Alternatively, select 'Run > Debug...' in the workbench menu bar, or Select 'Debug...' in the drop-down menu on the Debug tool bar button.
Create new 'Enhydra Application' launch configuration or select existing one (if you have already defined one for your Enhydra project) and 'Debug' it.
Your local Enhydra (Enterprise) Server (with Enhydra application deployed) is now launched, and text output is shown in the Console.
NOTE: Make sure the Enhydra (Enterprise) Server is not already running.
Enhydra project, launched in 'Debug' mode will offer additional development capabilities.
When started this way, Enhydra application project will recognize any additional application code change, recompile changed class and refresh loaded class in application class loader. This functionality allows you to adapt and change your application code during application runtime and verify immediate changes in application behavior without actual application restart.
NOTE: To enable this option you are obligate to have your Enhydra Project build rule set to 'Build Automatically' ('Project > Build Automatically' in your main workbench menu).
You are even able to change your (e.g.) HTML (XMLC) resources this way (at application runtime)! Enhydra XMLC will automatically generate and compile (on projects 'automatic build') changed java classes. The only problem is in fact that original sources are automatically generated by external build procedure (see 'enhydra-ant xmlc' external build procedure section in Project properties document) and Application class loader will not automatically recognize class file update. To apply those changes you will need to restart launched Enhydra Application.
NOTE: There is no need to run 'XML Compiler' and/or 'Ant Rebuild' tool. Just relaunch Enhydra Application!