acoliver 2002/11/24 12:26:31
Added: xdocs/site idedev-rdtomcat.xml
docs/site idedev-rdtomcat.html
Log:
instructions for making tomcat remote debuggable
Revision Changes Path
1.1 jakarta-site/xdocs/site/idedev-rdtomcat.xml
Index: idedev-rdtomcat.xml
===================================================================
<?xml version="1.0"?>
<document>
<properties>
<author email="[EMAIL PROTECTED]">Andrew C. Oliver</author>
<title>IDE Developer's Guide - Setting up Tomcat for Remote Debugging</title>
</properties>
<body>
<section name="Setting up Tomcat for Remote Debugging">
<p>
So you're ready to take the leap? You're going to edit a batch file!
Take a deep breath, now go to <a href="http://vim.sourceforge.net">VIM
Online</a> and download "vi for windows" so that you have a decent editor to use...
I'm only kidding. (You should know this guide is written using vim but
your computer, your choice ;-)). We'll step you through the basics and
what to stick in the file (its really simple) and you just use your favorite
editor to edit the file. Just ensure that your editor saves the file back
in text format and doesn't adorn it with markup or special characters, etc.
</p>
</section>
<section name="Disabling tomcat as a service">
<p>
Make sure Tomcat isn't running as a service. I don't think you can remote
debug a service, and running it this way isn't too useful for development.
Goto Start->Settings->Control Panel->Administrative Tools->Services
(in each version of Windows these move around so you may have to look
for them). Look for "Apache Tomcat" or "Tomcat" or something to that effect
and stop it. Open its properties and switch it to "Manual" if it is
currently loading Automatically. Once your done, close all that stuff.
</p>
</section>
<section name="Editing the tomcat batch file">
<p>
Make sure that Tomcat isn't running already. Presumably, you've shut it
down as a service, and know how to shut it down as a shell script if you
started it that way.
</p>
<p>
Open the Windows Explorer (not Internet Explorer. Open the thing you use
to move files and folders around). Navigate to where you installed
Tomcat. (Probably C:\Program files\Apache Tomcat...) Now navigate under
it to the "bin" subdirectory and edit a file called "catalina.bat" in your
favorite editor. Scroll down to the line that says:
"rem Guess CATALINA_HOME if not defined" and just before it add this line
via cut and paste (don't worry, you don't need to know what most of this
means...I sure as heck don't!):
"SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000" minus the quotes of
course.
Save and exit.
</p>
<p>
So what did that do for you? Well later on in the script the contents of
CATALINA_OPTS are passed to the "java" command. You could also enable
remote debugging for other programs by making sure the contents of this
after the equal sign were passed to the "java" command. These options tell
the java command not to run the <a
href="http://java.sun.com/products/hotspot/">HotSpot compiler</a>, enable the remote
debugging, and most importantly to
communicate with your IDE on port 8000 (that last part is the thing you're
most likely to change so note that!). If something else is already running
on port 8000, change this to something a little higher or lower (but not
8080 because thats probably where tomcat is running you know).
</p>
</section>
<section name="Environment Variables and Starting Tomcat">
<p>
So now you're ready to start tomcat as a shell script. Provided you have
TOMCAT_HOME and JAVA_HOME defined already you can probably double click the
"startup.bat" (which later runs catalina.bat), if not then you should
probably define those by right clicking on "My Computer" (from the desktop)
and clicking "properties" then the "advanced" tab and "environment variables".
</p>
<p>
If you want to set tomcat up for all users of your station then click new
under "System" otherwise do it under "User" environment variables. If
you're the only user, its probably safe to do it under System in case your
id ever changes. Define TOMCAT_HOME to point to the directory you
installed TOMCAT in, define JAVA_HOME to wherever the directory you installed
Java. Click OK or Apply. Go click on that "startup.bat". You should be
good to go from the Tomcat side. If not then you can probably open a
"Command Prompt window, "cd %TOMCAT_HOME%" and type "bin\startup.bat".
</p>
</section>
<section name="Why your Sysadmin won't let you run this in production">
<p>
Gosh remote debuggers are nice! Wouldn't it be nice to have this option
in production? HECK NO! Running with debugging turned on and the
HotSpot JIT compiler turned off is a SERIOUS performance drain. Not
particularly noticable on your workstation with you as one of the only
and few users, but in production we're talking BAD! Next, this is the
mother of security breeches! Meaning letting anyone connect to your server
and set a breakpoint, probably would be bad...
</p>
</section>
</body>
</document>
1.1 jakarta-site/docs/site/idedev-rdtomcat.html
Index: idedev-rdtomcat.html
===================================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!-- Content Stylesheet for Site -->
<!-- start the processing -->
<!-- ====================================================================== -->
<!-- GENERATED FILE, DO NOT EDIT, EDIT THE XML FILE IN xdocs INSTEAD! -->
<!-- Main Page Section -->
<!-- ====================================================================== -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<meta name="author"
value="Andrew C. Oliver">
<meta name="email" value="[EMAIL PROTECTED]">
<title>The Jakarta Site - IDE Developer's Guide - Setting up Tomcat for
Remote Debugging</title>
</head>
<body bgcolor="#ffffff" text="#000000" link="#525D76">
<table border="0" width="100%" cellspacing="0">
<!-- TOP IMAGE -->
<tr>
<td colspan="2">
<a href="http://jakarta.apache.org"><img
src="http://jakarta.apache.org/images/jakarta-logo.gif" align="left" border="0"/></a>
</td>
</tr>
</table>
<table border="0" width="100%" cellspacing="4">
<tr><td colspan="2">
<hr noshade="" size="1"/>
</td></tr>
<tr>
<!-- LEFT SIDE NAVIGATION -->
<td width="20%" valign="top" nowrap="true">
<p><strong>About Jakarta</strong></p>
<ul>
<li> <a href="../index.html">Welcome</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/news/index.html">News & Status</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/mission.html">Our Mission</a>
</li>
<li> <a href="http://jakarta.apache.org/site/faqs.html">Our
FAQs</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/library.html">Reference Library</a>
</li>
<li> <a
href="http://www.google.com/advanced_search?q=+site:jakarta.apache.org&hl=en&as_qdr=all">Search
Jakarta</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/vendors.html">Vendor Support</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/contact.html">Contacting Us</a>
</li>
</ul>
<p><strong>Download</strong></p>
<ul>
<li> <a
href="http://jakarta.apache.org/site/binindex.html">Binaries</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/sourceindex.html">Source Code</a>
</li>
</ul>
<p><strong>Get Involved</strong></p>
<ul>
<li> <a
href="http://jakarta.apache.org/site/getinvolved.html">How to ...</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/cvsindex.html">CVS Repositories</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/mail.html">Mailing Lists</a>
</li>
<li> <a href="http://jakarta.apache.org/site/bugs.html">Bug
Database</a>
</li>
</ul>
<p><strong>SubProjects</strong></p>
<ul>
<li> <a href="../alexandria/index.html">Alexandria</a>
</li>
<li> <a href="../ant/index.html">Ant</a>
</li>
<li> <a href="../avalon/index.html">Avalon</a>
</li>
<li> <a href="../bcel/index.html">BCEL</a>
</li>
<li> <a href="../bsf/index.html">BSF</a>
</li>
<li> <a href="../cactus/index.html">Cactus</a>
</li>
<li> <a href="../commons/index.html">Commons</a>
</li>
<li> <a href="../ecs/index.html">ECS</a>
</li>
<li> <a href="../james/index.html">James</a>
</li>
<li> <a href="../jetspeed/index.html">Jetspeed</a>
</li>
<li> <a href="../jmeter/index.html">JMeter</a>
</li>
<li> <a href="../log4j/index.html">Log4J</a>
</li>
<li> <a href="../lucene/index.html">Lucene</a>
</li>
<li> <a href="../ojb/index.html">OJB</a>
</li>
<li> <a href="../oro/index.html">ORO</a>
</li>
<li> <a href="../poi/index.html">POI</a>
</li>
<li> <a href="../regexp/index.html">Regexp</a>
</li>
<li> <a href="../slide/index.html">Slide</a>
</li>
<li> <a href="../struts/index.html">Struts</a>
</li>
<li> <a href="../taglibs/index.html">Taglibs</a>
</li>
<li> <a href="../tomcat/index.html">Tomcat</a>
</li>
<li> <a href="../turbine/index.html">Turbine</a>
</li>
<li> <a href="../velocity/index.html">Velocity</a>
</li>
<li> <a href="../watchdog/index.html">Watchdog</a>
</li>
</ul>
<p><strong>Project Management</strong></p>
<ul>
<li> <a
href="http://jakarta.apache.org/site/whoweare.html">Who We Are</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/guidelines.html">Project Guidelines</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/newproject.html">New Subprojects</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/jakarta-site2.html">Website Maintenance</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/acknowledgements.html">Acknowledgements</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/legal.html">Legal</a>
</li>
<li> <a
href="http://jakarta.apache.org/site/jspa-position.html">Apache on the JSPA</a>
</li>
</ul>
</td>
<td width="80%" align="left" valign="top">
<table
border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="Setting up Tomcat for Remote Debugging"><strong>Setting up Tomcat
for Remote Debugging</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
So you're ready to take the leap? You're going to edit a batch file!
Take a deep breath, now go to <a href="http://vim.sourceforge.net">VIM
Online</a> and download "vi for windows" so that you have a decent editor to use...
I'm only kidding. (You should know this guide is written using vim but
your computer, your choice ;-)). We'll step you through the basics and
what to stick in the file (its really simple) and you just use your favorite
editor to edit the file. Just ensure that your editor saves the file back
in text format and doesn't adorn it with markup or special characters, etc.
</p>
</blockquote>
</p>
</td></tr>
<tr><td><br/></td></tr>
</table>
<table border="0" cellspacing="0"
cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="Disabling tomcat as a service"><strong>Disabling tomcat as a
service</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
Make sure Tomcat isn't running as a service. I don't think you can remote
debug a service, and running it this way isn't too useful for development.
Goto Start->Settings->Control Panel->Administrative Tools->Services
(in each version of Windows these move around so you may have to look
for them). Look for "Apache Tomcat" or "Tomcat" or something to that effect
and stop it. Open its properties and switch it to "Manual" if it is
currently loading Automatically. Once your done, close all that stuff.
</p>
</blockquote>
</p>
</td></tr>
<tr><td><br/></td></tr>
</table>
<table border="0" cellspacing="0"
cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="Editing the tomcat batch file"><strong>Editing the tomcat batch
file</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
Make sure that Tomcat isn't running already. Presumably, you've shut it
down as a service, and know how to shut it down as a shell script if you
started it that way.
</p>
<p>
Open the Windows Explorer (not Internet Explorer. Open the thing you use
to move files and folders around). Navigate to where you installed
Tomcat. (Probably C:\Program files\Apache Tomcat...) Now navigate under
it to the "bin" subdirectory and edit a file called "catalina.bat" in your
favorite editor. Scroll down to the line that says:
"rem Guess CATALINA_HOME if not defined" and just before it add this line
via cut and paste (don't worry, you don't need to know what most of this
means...I sure as heck don't!):
"SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000" minus the quotes of
course.
Save and exit.
</p>
<p>
So what did that do for you? Well later on in the script the contents of
CATALINA_OPTS are passed to the "java" command. You could also enable
remote debugging for other programs by making sure the contents of this
after the equal sign were passed to the "java" command. These options tell
the java command not to run the <a
href="http://java.sun.com/products/hotspot/">HotSpot compiler</a>, enable the remote
debugging, and most importantly to
communicate with your IDE on port 8000 (that last part is the thing you're
most likely to change so note that!). If something else is already running
on port 8000, change this to something a little higher or lower (but not
8080 because thats probably where tomcat is running you know).
</p>
</blockquote>
</p>
</td></tr>
<tr><td><br/></td></tr>
</table>
<table border="0" cellspacing="0"
cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="Environment Variables and Starting Tomcat"><strong>Environment
Variables and Starting Tomcat</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
So now you're ready to start tomcat as a shell script. Provided you have
TOMCAT_HOME and JAVA_HOME defined already you can probably double click the
"startup.bat" (which later runs catalina.bat), if not then you should
probably define those by right clicking on "My Computer" (from the desktop)
and clicking "properties" then the "advanced" tab and "environment variables".
</p>
<p>
If you want to set tomcat up for all users of your station then click new
under "System" otherwise do it under "User" environment variables. If
you're the only user, its probably safe to do it under System in case your
id ever changes. Define TOMCAT_HOME to point to the directory you
installed TOMCAT in, define JAVA_HOME to wherever the directory you installed
Java. Click OK or Apply. Go click on that "startup.bat". You should be
good to go from the Tomcat side. If not then you can probably open a
"Command Prompt window, "cd %TOMCAT_HOME%" and type "bin\startup.bat".
</p>
</blockquote>
</p>
</td></tr>
<tr><td><br/></td></tr>
</table>
<table border="0" cellspacing="0"
cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="Why your Sysadmin won't let you run this in
production"><strong>Why your Sysadmin won't let you run this in production</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
Gosh remote debuggers are nice! Wouldn't it be nice to have this option
in production? HECK NO! Running with debugging turned on and the
HotSpot JIT compiler turned off is a SERIOUS performance drain. Not
particularly noticable on your workstation with you as one of the only
and few users, but in production we're talking BAD! Next, this is the
mother of security breeches! Meaning letting anyone connect to your server
and set a breakpoint, probably would be bad...
</p>
</blockquote>
</p>
</td></tr>
<tr><td><br/></td></tr>
</table>
</td>
</tr>
<!-- FOOTER -->
<tr><td colspan="2">
<hr noshade="" size="1"/>
</td></tr>
<tr><td colspan="2">
<div align="center"><font color="#525D76" size="-1"><em>
Copyright © 1999-2002, Apache Software Foundation
</em></font></div>
</td></tr>
</table>
</body>
</html>
<!-- end the processing -->
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>