8/13/2019 10 Troubleshooting
1/47
Copyright 2008, Oracle. All rights reserved.
Troubleshooting ADF BC Applications
8/13/2019 10 Troubleshooting
2/47
Copyright 2008, Oracle. All rights reserved.10 - 2
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
Use the JDeveloper debugger
Utilize sources of help
8/13/2019 10 Troubleshooting
3/47
Copyright 2008, Oracle. All rights reserved.10 - 3
Troubleshooting the Business Service
Test a business service in isolation from views or controllers: BC Browser
Java test clients
JDeveloper and ADF tools for logging and diagnostics:
Java logging
ADFLogger
ADF Diagnostics
Validate code at design time.
Build unit tests with JUnit.
Diagnose CLASSPATHand other file access problems: FileMon Diagnose performance problems: JDeveloper Profiler
Diagnose Web service problems: HTTP Analyzer, sample Web
client
Step through code: JDeveloper debugger
8/13/2019 10 Troubleshooting
4/47
Copyright 2008, Oracle. All rights reserved.10 - 4
Troubleshooting the UI
Java EE Logging (Java Logger, ADF Logger)
Design-time troubleshooting
Using the JDeveloper Debugger
Debugging through the source
8/13/2019 10 Troubleshooting
5/47
Copyright 2008, Oracle. All rights reserved.10 - 5
Using Logging and Diagnostics
Displaying debug messages to the console
Java logging
ADF logging / Oracle Diagnostic Logging (ODL)
8/13/2019 10 Troubleshooting
6/47
Copyright 2008, Oracle. All rights reserved.10 - 6
Displaying Debug Messages to the Console
Edit the projects run
configuration:
Set Java options:-Djbo.debugoutput=console
8/13/2019 10 Troubleshooting
7/47Copyright 2008, Oracle. All rights reserved.10 - 7
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 produceuseful messages.
You can configure Java logging to produce different levels
of logging output:
SEVERE
WARNING
INFO
CONFIG
FINE
FINER
FINEST
ALL
NONE
8/13/2019 10 Troubleshooting
8/47Copyright 2008, Oracle. All rights reserved.10 - 9
Core Java Logging
Edit /jre/lib/logging.properties:
Setjava.util.logging.ConsoleHandler.level=FINE
Add the line: com.sun.faces.level=FINE
Now the log contains JSF Reference Implementation
debug messages.
8/13/2019 10 Troubleshooting
9/47Copyright 2008, Oracle. All rights reserved.10 - 10
Using ADF Logging
ADF Logging is built on Oracle Diagnostic Logging (ODL),
which provides:
Capture of context information
Control over which messages are logged by setting: Logging level
Module filter
ODL uses a common format and repository for all
components in the WebLogic Server.
8/13/2019 10 Troubleshooting
10/47Copyright 2008, Oracle. All rights reserved.10 - 11
Configuring ADF Logging
The Oracle Diagnostic Logging (ODL) configuration file(logging.xml) controls the loggers under the oracle tree.
Set the logging threshold for the groups you are debugging(levels are SEVERE, WARNING, INFO, CONFIG, FINE,
FINER, or FINEST):
ADFm logger settings:
ADFv logger settings:
ADFc logger settings:
Optionally set the module filter.
Alternatively, create configuration in JDeveloper.
8/13/2019 10 Troubleshooting
11/47Copyright 2008, Oracle. All rights reserved.10 - 13
Creating Logging Configurations in JDeveloper
ADF Model debugging configuration:
Edit the projects run configuration.
Set Java options: -Djbo.debugoutput=adflogger-Djbo.adflogger.level=FINE
8/13/2019 10 Troubleshooting
12/47Copyright 2008, Oracle. All rights reserved.10 - 14
Viewing ODL Logs
8/13/2019 10 Troubleshooting
13/47Copyright 2008, Oracle. All rights reserved.10 - 15
Using Design-Time Code Validation
JDevelopers editors provide error cues and correction
suggestions for files such as:
XML
Java
JSPX
8/13/2019 10 Troubleshooting
14/47Copyright 2008, Oracle. All rights reserved.10 - 16
Design-Time XML Validation
8/13/2019 10 Troubleshooting
15/47Copyright 2008, Oracle. All rights reserved.10 - 17
Design-Time Java Code Validation
8/13/2019 10 Troubleshooting
16/47Copyright 2008, Oracle. All rights reserved.10 - 18
Design-Time JSPX Validation
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.
8/13/2019 10 Troubleshooting
17/47Copyright 2008, Oracle. All rights reserved.10 - 19
Using Tools and Utilities
JUnit
JDeveloper Profiler
FileMon
Web service sample client
JDeveloper HTTP Analyzer
JDeveloper Debugger
8/13/2019 10 Troubleshooting
18/47Copyright 2008, Oracle. All rights reserved.10 - 20
Testing Java Code with JUnit
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
http://www.junit.org/http://www.junit.org/8/13/2019 10 Troubleshooting
19/47Copyright 2008, Oracle. All rights reserved.10 - 21
Unit Testing with JUnit
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
8/13/2019 10 Troubleshooting
20/47Copyright 2008, Oracle. All rights reserved.10 - 22
Using JDevelopers Profiler
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
8/13/2019 10 Troubleshooting
21/47Copyright 2008, Oracle. All rights reserved.10 - 23
Running the Profiler
8/13/2019 10 Troubleshooting
22/47Copyright 2008, Oracle. All rights reserved.10 - 24
Identifying Search Paths on Windows with
FileMon
Useful for troubleshooting CLASSPATHproblems
Shows you the path that your running application is looking
in for classes and files
8/13/2019 10 Troubleshooting
23/47Copyright 2008, Oracle. All rights reserved.10 - 25
Troubleshooting Web Services
You can test Web services by:
Defining a sample client
Using the HTTP Analyzer
8/13/2019 10 Troubleshooting
24/47Copyright 2008, Oracle. All rights reserved.10 - 26
Troubleshooting Web Services: Sample Client
The sample Java client initializes a proxy to the Web
service.
You add custom code to call the Web service operations.
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.
greetingService_Service=new GreetingService_Service();
GreetingService greetingService =greetingService_Service.getGreetingServiceSoapHttpPort();
// Add your code to call the desired methods.
System.out.println(greetingService.sayHelloTo("Pam"));
8/13/2019 10 Troubleshooting
25/47Copyright 2008, Oracle. All rights reserved.10 - 27
Troubleshooting Web Services: HTTP Analyzer
1
2
4
5 6
3
8/13/2019 10 Troubleshooting
26/47
Copyright 2008, Oracle. All rights reserved.10 - 28
Using the JDeveloper Debugger
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.
8/13/2019 10 Troubleshooting
27/47
Copyright 2008, Oracle. All rights reserved.10 - 29
Understanding Breakpoint Types
Type Breaks when
Exception An exception of this class (or a subclass) is thrown.
SourceA particular source line in a particular class in a particular package
is run.
Method A method in a given class is invoked.
Class Any method in a given class is invoked.
Watchpoint A given field is accessed or modified.
8/13/2019 10 Troubleshooting
28/47
Copyright 2008, Oracle. All rights reserved.10 - 31
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
You can use actions other than stop with breakpoints.
8/13/2019 10 Troubleshooting
29/47
Copyright 2008, Oracle. All rights reserved.10 - 32
Declarative UI Debugging
The Declarative Debugger enables you to set breakpoints on:
Executables
Task flow activities
Bindings
Breakpoint reached:
8/13/2019 10 Troubleshooting
30/47
Copyright 2008, Oracle. All rights reserved.10 - 33
Using the EL Evaluator
The expression language evaluator enables:
Introspection of the values between the view and model
Watches based on EL
Using the discovery function An evaluated expression
An evaluated expression on watch list displays changed value.
8/13/2019 10 Troubleshooting
31/47
Copyright 2008, Oracle. All rights reserved.10 - 34
ADF Structure Pane and ADF Data Window
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
8/13/2019 10 Troubleshooting
32/47
Copyright 2008, Oracle. All rights reserved.10 - 35
Object Preferences
Filter out fields that
are displayed in
debugger.
Change default valuedisplayed in debugger.
Show expressions as
details instead of fields.
Customize types
throughout the
type hierarchy.
8/13/2019 10 Troubleshooting
33/47
Copyright 2008, Oracle. All rights reserved.10 - 36
Using Oracle ADF Source Code for Debugging
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
8/13/2019 10 Troubleshooting
34/47
Copyright 2008, Oracle. All rights reserved.10 - 37
Setting Up Oracle ADF Source Code for
Debugging
To use source code for debugging, you can:
Add the source zip into the user library
Add the library to a project
8/13/2019 10 Troubleshooting
35/47
Copyright 2008, Oracle. All rights reserved.10 - 38
Utilizing Quick Javadoc
Right-click a method and select Quick
Javadoc:
8/13/2019 10 Troubleshooting
36/47
Copyright 2008, Oracle. All rights reserved.10 - 39
Setting Breakpoints in Source Code
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.
8/13/2019 10 Troubleshooting
37/47
Copyright 2008, Oracle. All rights reserved.10 - 40
Using Common Oracle ADF Breakpoints
Useful for debugging declarative functionality
In oracle.jbopackage you can set breakpoints on:
JboException
DMLExceptionuicli.binding.JUCtrlActionBinding.doIt()
server.ViewObjectImpl.
executeQueryForCollection()
server.ViewRowImpl.setAttributeInternal()
server.EntityImpl.setAttributeInternal()
8/13/2019 10 Troubleshooting
38/47
Copyright 2008, Oracle. All rights reserved.10 - 41
Debugging Interactions with the Model Layer
Controlled by two classes:oracle.adf.controller.faces.lifecycle.FacesPageLifecycle
oracle.adf.controller.v2.lifecycle.PageLifecycleImpl
Set breakpoints if encountering problems such as: Components not displaying correctly with complete data
Validation errors not rendering properly
8/13/2019 10 Troubleshooting
39/47
Copyright 2008, Oracle. All rights reserved.10 - 42
Correcting Failures to Display Data
To debug all executables:oracle.adf.model.binding.DCBindingContainer
internalRefreshControl(int, boolean)
To debug the method iterator:oracle.jbo.uicli.binding.JUMethodIteratorDefinitSourceRSI()
To debug an attribute binding:oracle.jbo.uicli.binding.JUCtrlValueBinding
getInputValue()
8/13/2019 10 Troubleshooting
40/47
Copyright 2008, Oracle. All rights reserved.10 - 45
Correcting Failures to Invoke Actions and
Methods
Actions are ignored if an executable or its target binding is
not executed.
You can debug action or method invocation by breaking on
DCDataControl.invokeOperation(), which is entrypoint for action and method execution.
You can debug invocation of coded methods by breakingon DCGenericDataControl.invokeOperation().
8/13/2019 10 Troubleshooting
41/47
Copyright 2008, Oracle. All rights reserved.10 - 47
Debugging Life Cycle Events: Task Flows
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()
8/13/2019 10 Troubleshooting
42/47
Copyright 2008, Oracle. All rights reserved.10 - 48
Debugging Life Cycle Events:
Parameters and Methods
For debugging the ADF controllers interpretation of the
navigation routing:oracle.adfinternal.controller.engine.
ControlFlowEngine.doRouting() For debugging before view activitys input parameters are
evaluated:oracle.adfinternal.controller.
application.PageParameterPagePhaseListener
.beforePhase()
For calling an ADF controller method action:oracle.adfinternal.controller.activity.MethodCallActivityLogic.execute()
8/13/2019 10 Troubleshooting
43/47
Copyright 2008, Oracle. All rights reserved.10 - 49
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()
8/13/2019 10 Troubleshooting
44/47
Copyright 2008, Oracle. All rights reserved.10 - 50
Obtaining Help
Sources of help include:
Online Help
Javadoc
Support (MetaLink)
Forums
Blogs
Internet Search
8/13/2019 10 Troubleshooting
45/47
Copyright 2008, Oracle. All rights reserved.10 - 51
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) ifyou 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.
8/13/2019 10 Troubleshooting
46/47
Copyright 2008, Oracle. All rights reserved.10 - 52
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
Use the JDeveloper debugger
Utilize sources of help
8/13/2019 10 Troubleshooting
47/47
Practice 10 Overview:
Troubleshooting
This practice covers running the JDeveloper debugger to
diagnose a problem with the ADF BC model.
Top Related