blob: 3027f8e977ab29be43f487aacdde6759bdfe1dde [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/. Contributors: IBM Corporation - initial API and implementation" />
<meta name="DC.rights.owner" content="(C) Copyright 2000, 2011" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="task" name="DC.Type" />
<meta name="DC.Title" content="Debugging a servlet on a server" />
<meta name="abstract" content="The debugger enables you to detect and diagnose errors in your application. It allows you to control the execution of your program by setting breakpoints, suspending threads, stepping through the code, and examining the contents of the variables. You can debug a servlet on a server without losing the state of your application." />
<meta name="description" content="The debugger enables you to detect and diagnose errors in your application. It allows you to control the execution of your program by setting breakpoints, suspending threads, stepping through the code, and examining the contents of the variables. You can debug a servlet on a server without losing the state of your application." />
<meta content="breakpoints, servlets, servers, debugging servlets, debugging on servers, threads, suspending in servlets" name="DC.subject" />
<meta content="breakpoints, servlets, servers, debugging servlets, debugging on servers, threads, suspending in servlets" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="../topics/tdebug.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="tservlet_wst" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
<title>Debugging a servlet on a server</title>
</head>
<body id="tservlet_wst"><a name="tservlet_wst"><!-- --></a>
<h1 class="topictitle1">Debugging a servlet on a server</h1>
<div><p>The debugger enables you to detect
and diagnose errors in your application. It allows you to control
the execution of your program by setting breakpoints, suspending threads,
stepping through the code, and examining the contents of the variables.
You can debug a servlet on a server without losing the state of your
application.</p>
<div class="section" id="tservlet_wst__tservlet_context"><a name="tservlet_wst__tservlet_context"><!-- --></a>To debug a servlet on a server:</div>
<ol>
<li class="stepexpand" id="tservlet_wst__tservlet_step1"><a name="tservlet_wst__tservlet_step1"><!-- --></a><span>In the Project Explorer view, open
your servlet.</span> In a Web project, servlets are located in
the JavaSource folder. The servlet opens in an editor.</li>
<li class="stepexpand" id="tservlet_wst__tservlet_step2"><a name="tservlet_wst__tservlet_step2"><!-- --></a><span>To set one or more breakpoints in the
editor, double-click in the margin beside the line of code that you
want to set as a breakpoint.</span></li>
<li class="stepexpand" id="tservlet_wst__tservlet_step3"><a name="tservlet_wst__tservlet_step3"><!-- --></a><span>Ensure the project is associated to
run on a server.</span></li>
<li class="stepexpand" id="tservlet_wst__tservlet_step4"><a name="tservlet_wst__tservlet_step4"><!-- --></a><span>Select the servlet and from the servlet's
context menu in the Project Explorer view, click <span class="uicontrol">Debug
As &gt; Debug on Server</span>.</span> Open the Servers view
to see that the server is launched.</li>
<li class="stepexpand" id="tservlet_wst__tservlet_step5"><a name="tservlet_wst__tservlet_step5"><!-- --></a><span>When the breakpoint is hit, the Debug
view opens.</span> Step through the code, inspect and display
variables, and make any necessary changes to the servlet. For detailed
information on debugging, refer to the online help.</li>
<li class="stepexpand" id="tservlet_wst__tservlet_step6"><a name="tservlet_wst__tservlet_step6"><!-- --></a><span>When you are finished debugging, save
the servlet.</span> Wait for the debugger to refresh and pick
up the changes. When the debugger refresh is complete, the execution
of the code resumes at the beginning of the method that was currently
running.</li>
<li class="stepexpand" id="tservlet_wst__tservlet_step7"><a name="tservlet_wst__tservlet_step7"><!-- --></a><span>Click the <span class="uicontrol">Resume</span> icon
on the Debug toolbar to execute the servlet.</span></li>
<li class="stepexpand" id="tservlet_wst__tservlet_step8"><a name="tservlet_wst__tservlet_step8"><!-- --></a><span>If you have hot method replace enabled,
your changes are already in the running application.</span></li>
<li class="stepexpand" id="tservlet_wst__tservlet_step9"><a name="tservlet_wst__tservlet_step9"><!-- --></a><span>If you have automatic class reloading
enabled, which is the default setting, click the <span class="uicontrol">Refresh</span> icon
in the Web Browser to update the changes.</span> You do not lose
the state of your application.</li>
<li class="stepexpand"><span id="tservlet_wst__tservlet_cmd10"><a name="tservlet_wst__tservlet_cmd10"><!-- --></a>If you do not have automatic class
reloading enabled, you lose the state of the application.</span> To update the changes, restart the server.
</li>
</ol>
<div class="section" id="tservlet_wst__tservlet_result"><a name="tservlet_wst__tservlet_result"><!-- --></a><p>The result is the server recognizes
your changes.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="../topics/tdebug.html" title="You can debug applications on a server to detect and diagnose errors in your application. Use the TCP/IP monitor view to view data sent and received over the ports of the server. In addition, use the debugging tools in the workbench to control running your application on the server by setting breakpoints, suspending threads, stepping through the code, and examining the contents of the variables. You can debug the following artifacts on a server without losing the state of your application:">Debugging applications on a server</a></div>
</div>
</div>
</body>
</html>