Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Objectives
After completing this lesson, you should be able to do the following: Use tools for logging and diagnostics Utilize design-time code validation Make use of FileMon and JUnit Use the JDeveloper profiler Test Web service calls:
Use a sample client to call a Web service Use the JDeveloper HTTP Analyzer
10 - 2
10 - 3
Validate code at design time. Build unit tests with JUnit. Diagnose CLASSPATH and other file access problems: FileMon Diagnose performance problems: JDeveloper Profiler Diagnose Web service problems: HTTP Analyzer, sample Web client Step through code: JDeveloper debugger
Copyright 2008, Oracle. All rights reserved.
Troubleshooting the UI
Java EE Logging (Java Logger, ADF Logger) Design-time troubleshooting Using the JDeveloper Debugger Debugging through the source
10 - 4
Displaying debug messages to the console Java logging ADF logging / Oracle Diagnostic Logging (ODL)
10 - 5
10 - 6
Java Logging
It is useful in environments where you cant run the debugger or where running the debugger might hide the problem. Many Java programs use the Java logging API to produce useful messages. You can configure Java logging to produce different levels of logging output:
SEVERE WARNING INFO CONFIG FINE FINER FINEST ALL NONE
10 - 7
Edit <Java_Home>/jre/lib/logging.properties:
Set java.util.logging.ConsoleHandler.level=FINE Add the line: com.sun.faces.level=FINE
10 - 9
ODL uses a common format and repository for all components in the WebLogic Server.
10 - 10
ADFm logger settings: <logger name="oracle.adf" level="FINE"/> <logger name="oracle.jbo" level="FINE"/> ADFv logger settings: <logger name="oracle.adf" level="FINE"/> <logger name="oracle.adfinternal" level="FINE"/> ADFc logger settings: <logger name="oracle.adf.controller" level="FINE"/> <logger name="oracle.adfinternal.controller" level="FINE"/>
10 - 11
ADF Model debugging configuration: Edit the projects run configuration. Set Java options: -Djbo.debugoutput=adflogger -Djbo.adflogger.level=FINE
10 - 13
10 - 14
JDevelopers editors provide error cues and correction suggestions for files such as: XML Java JSPX
10 - 15
10 - 16
10 - 17
As you edit a page, the XML syntax is checked and errors and warnings are flagged. Errors are visible in Design, Source and Bindings editors.
10 - 18
JUnit JDeveloper Profiler FileMon Web service sample client JDeveloper HTTP Analyzer JDeveloper Debugger
10 - 19
Open source regression testing framework Useful for creating tests to verify Java code JDevelopers JUnit extension provides wizards for creating test components. More information and examples:
SRDemo sample application Toystore sample application JDeveloper online documentation http://www.junit.org
10 - 20
JUnit makes it easy for developers to write and run repeatable tests. Its features include: Assertions for testing expected results Test fixtures for sharing common test data Test suites for organizing and running tests Graphical and textual test runners
10 - 21
With the Profiler, you can: Monitor programs as they run Find bottlenecks and memory leaks Two types of profiling: CPU: Method processing times Memory: Allocation and freeing of data objects
10 - 22
10 - 23
10 - 24
You can test Web services by: Defining a sample client Using the HTTP Analyzer
10 - 25
The sample Java client initializes a proxy to the Web service. You add custom code to call the Web service operations.
greetingService_Service=new GreetingService_Service(); GreetingService greetingService = greetingService_Service.getGreetingServiceSoapHttpPort(); // Add your code to call the desired methods. System.out.println(greetingService.sayHelloTo("Pam"));
10 - 26
To create a sample client, select Create Client for Web Service Annotations in the context menu. It is not automatically synchronized with the Web service.
Copyright 2008, Oracle. All rights reserved.
10 - 27
It is very useful for pinpointing problems in your application. Set source breakpoints to pinpoint problems in custom code. Set exception breakpoints to stop when a particular exception is thrown. When breakpoint is encountered at run time, you can step through code and view values of variables. To run an application in debug mode, right-click and select Debug.
10 - 28
Type
Exception
Breaks when
An exception of this class (or a subclass) is thrown. A particular source line in a particular class in a particular package is run. A method in a given class is invoked.
Source
Method
Class
Watchpoint
10 - 29
Using Breakpoints
You can create groups of breakpoints that can be enabled or disabled all at once. You can use conditional breakpoints. Examples:
value instanceof oracle.jbo.domain.Date status.equalsIgnoreCase("shipped") i > 50
10 - 31
Declarative UI Debugging
The Declarative Debugger enables you to set breakpoints on: Executables Task flow activities Bindings Breakpoint reached:
10 - 32
The expression language evaluator enables: Introspection of the values between the view and model Watches based on EL
An evaluated expression
10 - 33
During debugging: ADF Structure Pane shows items in current viewport ADF Data Window shows data within:
Item selected in ADF Structure Pane ADF context Scoped variables
10 - 34
Object Preferences
Filter out fields that are displayed in debugger. Change default value displayed in debugger. Show expressions as details instead of fields. Customize types throughout the type hierarchy.
10 - 35
Adding ADF source code enables you to: Access Javadocs in the code editor Set breakpoints on Oracle code as well as your own Access symbolic names via Debug libraries
10 - 36
10 - 37
10 - 38
To set a breakpoint in Oracle code, perform the following steps: 1. Press [Ctrl] + [-]. 2. Enter an Oracle ADF class name or its uppercase letters. 3. Set breakpoints in the source file that JDeveloper opens.
10 - 39
Useful for debugging declarative functionality In oracle.jbo package you can set breakpoints on:
JboException DMLException uicli.binding.JUCtrlActionBinding.doIt() server.ViewObjectImpl. executeQueryForCollection() server.ViewRowImpl.setAttributeInternal() server.EntityImpl.setAttributeInternal()
10 - 40
Set breakpoints if encountering problems such as: Components not displaying correctly with complete data Validation errors not rendering properly
10 - 41
10 - 42
10 - 45
Before a task flow is called: oracle.adfinternal.controller.activity. TaskFlowCallActivityLogic.execute() Before a task flows input parameters are resolved: oracle.adfinternal.controller.activity. TaskFlowCallActivityLogic.getInputValues() Before and after a task flow returns: oracle.adfinternal.controller.activity. TaskFlowReturnActivityLogic.execute()
10 - 47
10 - 48
Debugging Life Cycle Events: Switching Between Main Page and Regions
To keep track of the context switching between the main page and regions, set a breakpoint in: oracle.adfinternal.controller.state. RequestState.setCurrentViewPortContext()
10 - 49
Obtaining Help
Sources of help include: Online Help Javadoc Support (MetaLink) Forums Blogs Internet Search
10 - 50
Requesting Help
Post your request to the appropriate forum: Use meaningful subject line. Describe exact steps to reproduce the problem. Include exact error information (error number, exception) if you receive an error message. Include a stack trace if appropriate. Include a test case if possible. List technologies and product version numbers. Concrete examples are better than abstract descriptions. Mention troubleshooting steps you have tried and how they affected the problem.
10 - 51
Summary
In this lesson, you should have learned how to: Use tools for logging and diagnostics Utilize design-time code validation Make use of FileMon and JUnit Use the JDeveloper profiler Test Web service calls:
Use a sample client to call a Web service Use the JDeveloper HTTP Analyzer
10 - 52
10 - 53