Academic Tutorials



English | French | Portugese | German | Italian
Home Advertise Payments Recommended Websites Interview Questions FAQs
News Source Codes E-Books Downloads Jobs Web Hosting
Chats

Weblogic Tutorial
WebLogic Tutorial Introduction
The WebLogic Workshop Development Environment
Developing Applications
Applications and Projects
Workshop File Types
Debugging Your Application
Managing the Build Process
Compile a Single Java File
Source Control Systems
Message Logging
Working with Java Controls
Developing Web Applications
Designing Asynchronous Interfaces
Handling XML with XMLBeans
Building Integration Applications
Building Portal Applications
Developing Enterprise JavaBeans
The Life Cycle of an Entity Bean
Session Beans
Developing Message-Driven Beans
WebLogic Workshop Security Overview
Deploying an Application

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting
Network Sites


Debugging Your Application


Previoushome Next









Debugging Your Application


You can use the WebLogic Workshop integrated debugger to debug your application. The debugger allows you to set breakpoints, step through your code line-by-line, view local variables, set watches on variables, and view the call stack and exception information.
A D V E R T I S E M E N T

There are a variety of properties that can be set for the debugger. Some are set on a project basis, while others apply only to Java and Control Projects.

You can use the debugger on runnable files, non-runnable files, non-Workshop enabled servers, and projects developed against a remote server. You can also attach to JUnit and use the JUnit functionality in conjunction with the Weblogic WorkShop Debugger.


Using the Debugger


In order to debug an application, you must have a way to exercise the application as a real client would. WebLogic Workshop includes a Test Browser in which you may test Workshop web applications and web services. When you run a web application or web service, the Test Browser automatically loads Test View, a tool for exercising the application.

To start the debugger, click the Start button on the toolbar or press Ctrl-F5. To pause debugging, click the Pause button on the toolbar. To stop debugging, click the Stop button on the toolbar.

When the debugger is started, the WebLogic Workshop Debugger command window is opened for the debugger proxy. This window must remain open in order to use the debugger. If you close this window, your breakpoints will not be hit when you test your application.

While your application is running in the debugger, it is unavailable to clients other than the Test Browser.

To debug your project, you will use breakpoints, the commands that allow you to navigate the code, and the debug windows, which show information about variable values, how the program is running, and what code is executed.


Breakpoints


Breakpoints allow you to halt execution at a specified point in the program so you can observe information about its operation. When you halt execution at a breakpoint, you can step through the program line-by-line, step over a breakpoint, and use the debug windows to change values or execute arbitrary code.

The types of breakpoints you can set include:

  • Line Breakpoints - halts execution at the line of code before the breakpoint
  • Exception Breakpoints - halts execution when an exception occurs
  • Method Breakpoints - halts execution as soon as a specified method is called
  • Taglib Breakpoints - halts at the taglib method being implemented
  • JSP Breakpoints - used with JSP files only
To create Exception and Method breakpoints, select Debug-->Create Breakpoint and enter the appropriate settings in the Create Breakpoint dialog.

To create a Line breakpoint, put the cursor on the line of code where you want to halt execution and click the Toggle Breakpoint button on the toolbar.

To clear all breakpoints at once including exception breakpoints in the project, click the Clear All Breakpoints button on the toolbar, or press Ctrl-F9.


Using the Debugging Commands


Once execution is halted on a breakpoint, you can use one of the following commands to continue executing your code with the debugger. All of these commands are available on the toolbar and on the Debug menu.

  • Step Into: The Step Into command continues execution line-by-line, beginning with the next line of code. Use this command if you want to debug your code one line at a time.
  • Step Over: The Step Over command executes a method call without debugging that method, and halts execution on the next line. Use this command if you know that the code in a method works and you don't need to step into it.
  • Step Out: The Step Out command finishes executing a method and returns execution to the procedure that called it, halting on the line immediately following the method call. Use this command if you have stepped into a method and you don't want to continue stepping all the way through it.
  • Continue: The Continue command resumes execution until another breakpoint is encountered or the procedure has completed.
  • Export Threads: The Export Threads command, found in the Debug menu, creates and opens a text file that contains the call stacks of all of the threads that are running. This is a convenient way to save or share the current threads in the event of a deadlock or other threading problem. The command is only active when the debugger has thread information.
Note that if you step into a line that contains more than one statement, all of the statements on that line will be executed when you step to the next line.

Debug Windows


The debug windows provide information about values and conditions in your code while you're running it in the debugger. There are several to choose from:

  • Locals Window - shows variables that are in scope
  • Watch Window - displays the value of a specified variable while debugging
  • Stream Window - shows output stream for JSPs
  • Immediate Window - allows you to execute code while debugging
  • Call Stack Window - shows the methods called to get to the point at which execution halted
  • Threads Window - shows information about currently executing threads
  • Breakpoints Window - lists currently set breakpoints
To view one of the debug windows, choose Debug Windows from the View menu, and select the desired window. For more detailed information about the debug windows,

 




Debugging Properties


Several debugging options can be set on a project scope. The debugging options for each project in an application are independent, and are not set on an application basis.

Debugging properties for a project can be set on the Project Properties dialog box. To change them, pull up the project properties by either right-clicking the project folder in the Application tab and selecting Properties from the context menu, or by going to Tools-->Project Properties-->[Project_Name], then select Debugger in the pane on the left.

Alternatively, project debugging properties can be set by editing the WORK configuration file associated with the project.

Some project debugging properties apply only to specific types of projects.


Smart Debugging


Smart debugging lets you focus on debugging your code and not platform code. When you step through code, you stay in your own code. When smart debugging is enabled, you can specify classes that the debugger will automatically step through. Typically, the filtered classes are part of the WebLogic Platform. For example, if you step into a method that's part of WebLogic Server and that method eventually calls your own code, the debugger will step directly into your code. For web application projects, this should almost always be left on.

Smart debugging is enabled by default, and a default list of classes is generated automatically. You can disable filtering on parts of the class list by checking or unchecking the group of classes in the debugging properties dialog. For example, if you uncheck XML classes, the debugger will step into platform classes that support XML.

With version 8.1 SP2 or higher, you can add, remove, and edit the class list. The asterisk (*) wildcard can be used to specify packages and subpackages.


Build Before Debugging


This option specifies whether the project should be rebuilt before it is run in the debugger. For web applications, only the current file is rebuilt before running. For Java projects, the entire project is built before running.

By default, the Build before debugging option is enabled.


Pause All Threads After Stepping


This option specifies which threads are shown in the Threads window after stepping in the debugger. All threads are always suspended after hitting a breakpoint, but by default only the thread in which you are stepping is visible. By default, this option is disabled to provide better performance, so other threads will not be visible in the threads window. If you choose not to suspend all threads after stepping, you can still view them on demand using the Pause command.


Java and Control Project Options


Process Settings


The Create new process and Attach to process radio buttons specify whether the debugger runs the application is run locally or attaches to a remote process. These settings apply only to Java and Control projects.

Create new process settings

When this option is selected, the debugger starts a new Java Virtual Machine for the application when you click Start. The following options can be set for this process:

  • Main class: The name of the class containing the main method that is the entry point for the application.
  • Parameters: Arguments that are passed to the main method.
  • VM parameters: Arguments that are passed to the virtual machine when it starts. These arguments may include -D and -X virtual machine options.
  • Home directory: The directory in which to start the Java application.
  • Application classpath: Classpath used by the virtual machine.
  • Automatically append Library JARs: When this option is enabled, all of the JARs specified in the Libraries folder are appended to the classpath.
  • Automatically append server classpath: Then this option is enabled, all of the JARs that are specified in the"Default server classpath" list in Tools-->WebLogic Server-->Server Properties are appended to the classpath.

Attach to process

When this option is selected the debugger is attached to a specified Java virtual machine that is already running and is configured to accept a debugger when you click Start.

  • Socket: Connects to the virtual machine over the TCP/IP connector. You must specify the port on which the VM is listening. If blank, the server defaults to localhost.
  • Shared memory: Connects to the virtual machine over the shared memory connector. You must specify the memory address on which the VM is listening.

 




Debugging Scenarios


The WebLogic Workshop integrated debugger can be used in many debugging scenarios, as listed in this topic.

Remote Debugging


If you're developing against a remote server, you can also debug against that remote server. Breakpoints and other debugging information will be stored on the local machine.

You can also debug on a managed server, as described below.


Debugging JSP Pages


Be aware that browser caching is always turned off when you are debugging. To turn caching on while you are debugging, place the following scriptlet in your JSP pages.

<% 
    response.setHeader( "Cache-Control", null ); 
%>

Note that browser caching is the default behavior when your web application is deployed to a production server. You do not need to take special measures, such as the scriptlet above, to turn on caching on a production server.


Debugging EJBs


The debugger supports debugging EJBs regardless of whether they have been developed within WebLogic Workshop. They can be debugged locally or remotely.

Use the following procedure to attach the debugger to an EJB:

  1. Open the source in Workshop
  2. From the Tools menu choose Project Properties.
  3. In the Debugger tab, choose Attach to Process.
  4. Enter the debug port number (8453 by default) and server name or IP address.
  5. Click Start.
  6. Set breakpoints as needed and start debugging.

Debugging on a Non-Workshop-Enabled Server


To debug a project on a server not configured as a Workshop Server, open the Project Properties dialog box for the project you want to debug. On the Debugger tab, choose the "Non Workshop Server" radio button, and enter the debugging port number (8453 by default), the Http port number, and the name or IP address of the remote server.


Debugging on a Managed Server


To debug a project on a managed server, set up the front end host and port for the cluster and/or managed servers. Cluster servers can be set up using a proxy. Run all of the managed servers except one, and the admin server with nodebug on the start line. Do all of your debugging against the managed server.


Debugging Unrunnable Files


Some files cannot be directly run by WebLogic Workshop; these include servlets, custom Java controls, Java files, and so on. Nevertheless, you can still set and hit breakpoints in these files. For example, to debug a servlet, set breakpoints in the servlet source code, add a JSP page to your project, run that JSP page (this will start the debugging process), and then enter the servlet's URL directly into the browser's address bar. You will now be able to halt at breakpoints in the servlet code.

To debug custom Java controls or Java files, set breakpoints in the source code of those files, and then run a web service or some other runnable file that calls into the Java control or Java file.


Starting Two Debugging Proxies in the Same Domain


If you start two server instances in the same domain (for example, using the start up script [BEA_HOME]/weblogic81/samples/domains/portal/startWebLogic.cmd), the second server will fail with a TransportException.

    ERROR: Proxy already running...
    weblogic.debugging.comm.TransportException
    at weblogic.debugging.comm.ServerConnectInfo.createTransport()Lweblogic.
    debugging.comm.CommTransport;(ServerConnectInfo.java:63)

The failure is caused by the debugging proxy, which attempts to open the same server socket port already used by the first server. To start the second server running on a different port, send a port number parameter to (1) the WebLogic Workshop IDE, (2) the server, and (3) the debugger. These are described below.

To Set the Port Number on the WebLogic Workshop IDE


Add the following parameter to [BEA_HOME]\weblogic81\workshop\workshop.cfg.

    -Dworkshop.debugProxyPort=PORT_NUMBER

To Set the Port Number on the Server


Add the following parameter to the server startup script (for example, [BEA_HOME]\weblogic81\samples\domains\workshop\startWebLogic.cmd/.sh).

    -Dworkshop.debugProxyPort=PORT_NUMBER

To Set the Port Number on the Debugger Process


Add the following parameter to the server startup script (for example, [BEA_HOME]\weblogic81\samples\domains\workshop\startWebLogic.cmd/.sh).

    -serverport=PORT_NUMBER

 




Testing Your Application


Testing your application goes hand-in-hand with debugging. The test facility that comes with Weblogic Workshop runs in a browser window and is known as Test View.

In addition to Test View, you can use JUnit for testing from within Workshop.

Follow the links below for more information on using Test View and JUnit.



Be the first one to comment on this page.




  Weblogic Tutorial eBooks

No eBooks on Weblogic could be found as of now.

 
 Weblogic Tutorial FAQs
More Links » »
 
 Weblogic Tutorial Interview Questions
More Links » »
 
 Weblogic Tutorial Articles

No Weblogic Articles could be found as of now.

 
 Weblogic Tutorial News

No News on Weblogic could be found as of now.

 
 Weblogic Tutorial Jobs

No Weblogic Articles could be found as of now.


Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previoushome Next

Keywords: Debugging Your Application, WEBLOGIC, WebLogic, WebLogic tutorials, WebLogic tutorial pdf, history of WebLogic, How To Deploy An Application Using WebLogic , learn WebLogic

HTML Quizzes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
HLML Quiz
XML Quizzes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizzes
JavaScript Quiz
VBScript Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizzes
ASP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
PL/SQL Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizzes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
VC++ Quiz
Multimedia Quizzes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building Quizzes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizzes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
JBOSS Quiz
Programming Langauges Quizzes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizzes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizzes
Oracle Quiz
MySQL Quiz
Operating System Quizzes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
MIDI Quiz
Software Testing Quizzes
Testing Quiz
Firewalls Quiz
SAP Module Quizzes
ERP Quiz
ABAP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizzes
Corba Quiz
Networking Quiz
Microsoft Office Quizzes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizzes
Financial Accounting Quiz
Managerial Accounting Quiz
Testimonials | Contact Us | Link to Us | Site Map
Copyright ? 2008. Academic Tutorials.com. All rights reserved Privacy Policies | About Us
Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | Discussions World | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Indian Free Ads | Jobs Assist | New Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Webhosting in India | Dedicated Server in India | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Testing Interview Questions | Tests World | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World | Important Websites
Copyright ? 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.