Вы находитесь на странице: 1из 26

Using the Oracle9i JDeveloper Debugger

with the OA Framework

Copyright © Oracle Corporation, 2002. All rights reserved.


Objectives

After completing this lesson, you should be able to


do the following:
• Debug an OA Framework-based application using
the JDeveloper debugger and other methods
• Use the debugger to examine variables and
arguments at runtime
• Use the debugger to modify variables and
arguments at runtime

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Oracle9i JDeveloper Debugger

• Helps find and fix program errors:


– Run-time errors
– Logic errors
– Coding errors
• Allows you to
– Control program execution
– Examine program variables
– Modify program variables
– Step through methods
– Set breakpoints

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Invoking the Oracle9i JDeveloper
Debugger for OA Framework Pages
• Invoke from the Debug
menu, or
• Run option from the context
menu while your page XML
file or a JSP file is selected.

• Do not run the debugger on


your project (.jpr) file.

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Fundamentals of Debugging

To debug a program with the debugger:


• Set points at which you want execution to pause
• Examine execution path
• Examine variables
• Examine program control mechanisms (loops)

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Breakpoints

• Cause execution to pause on a specific line of


code
• You may create multiple breakpoints
• Breakpoints can be conditional
• Define columns displayed in window
– Description
– Type
– Status
• You can define breakpoints at runtime
• Set a breakpoint by clicking in the
margin of the source code

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Setting Breakpoints

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Editing Breakpoints

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Editing Breakpoints

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Breaking on Exceptions

• When you get an exception, create a new


breakpoint with the Exception breakpoint type.
• Copy your exception from the error message
exception stack and paste it into your new
breakpoint.

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Setting Breakpoints During Runs

To set an exception or
other breakpoint when
you are not yet in the
debugger, select:
View > Debug Windows >
Breakpoints
from the main menu.

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Exception-style Breakpoint

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Debugger Windows: Data

The Data window shows you arguments and local


variables.
• You can drill into data.
• You can modify values during the debug run.

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Debugger Windows: Smart Data

• Smart Data shows data used in the code you are


stepping through.
• Smart Data window is more resource intensive.

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Debugger Windows: Stack

The Stack window lists the name of the classes and


methods that have been executed on the selected
thread but not yet completed.

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Other Debugger Windows

• Classes: Displays list of loaded classes and status


• Watch: Evaluates and displays expressions

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Customizing Debugger Windows

• All the debugger windows can be customized


• Right click the window you want to customize
• Select Settings or Edit Filters from the context
menu

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Stepping Through a Program

Step through a program by using the buttons on the


Debugger toolbar:
• Start the debugger
• Resume the program
• Step over a method call
• Step into a method call
• Step out of a method call
• Step to the end of the method
• Pause execution
• Stop the debugger

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Stepping Through a Program

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Debugging Declarative Applications

Pages built with the OA Framework are mostly made


up of declarative data, so debugging often requires
more than just the debugger.
• Read any error messages carefully.
– The message may indicate spelling or other mistakes.
– The exception stack gives you information on what
classes and lines of code to look at.

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


More Debugging Tips

• Check the easy things first (spelling, capitalization,


data).
• Check file locations by rolling over the filename in
the Navigator.
• Look at page XML files to help locate bad
declarative values within the page (do not edit
them directly).
• Learn the common event flows such as commit
cycles and button handling.
– See the OA Framework Developer's Guide for more
information.

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Understand BC4J Interactions

• Follow BC4J interactions from an item (field) to the


underlying BC4J objects.
– Root AM, View Instance, and View Attribute
properties for a pageLayout region, tables, and items
Are these set correctly?
– View object definitions and code
Is the query correct? Does it return data?
Are the attribute settings and mappings correct?
– Entity object definitions and code
– Entity associations and view links
– Application module definitions and code
Are the view objects included correctly?

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Understand BC4J Interactions

• Check any redirections, links, and forwards to other


pages or the same pages, either in Destination URI
property or in code.
Are view attribute names correct?
Are you passing correct parameter names and values?
Are page URL paths and function names correct?
• Check if a page is getting the AM state information it
expects.
Does the page have AM State Required set correctly?
Is the RetainAM flag set correctly for the transition to
the page?

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Debugging Validation and Commits

If you are using entity experts, validation VOs, and


validation AMs and getting errors:
• Is the ExpertClass property set correctly on the
owning entity object?
• Is the VAMDef property set correctly on the owning
entity object?
• Are the validation VOs included in the VAM?
• Is the validation code written correctly?
• If you are writing data back to the entity object (in
processFormData, through the VO), was the entity
object actually created properly?

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.


Demonstration

Copyright © Oracle Corporation, 2002. All rights reserved.


Summary

In this lesson, you should have learned how:


• You can use the JDeveloper9i Debugger to debug a
Java program by:
– Stepping through the execution path
– Examining arguments and variables
– Modifying variables and arguments at runtime
• Use other methods to relate information about the
problem to declarative information in your
application.

9-‹#› Copyright © Oracle Corporation, 2002. All rights reserved.

Вам также может понравиться