markt 2005/01/17 13:53:55 Modified: xdocs-faq project.xml Added: xdocs-faq development.xml Log: Add content from jakarta-site2\\xdocs\\site\\idedev-rd*.xml to Tomcat FAQ Revision Changes Path 1.10 +1 -0 jakarta-tomcat-site/xdocs-faq/project.xml Index: project.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-site/xdocs-faq/project.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- project.xml 10 Nov 2004 17:52:18 -0000 1.9 +++ project.xml 17 Jan 2005 21:53:55 -0000 1.10 @@ -22,6 +22,7 @@ <item name="Connectors" href="connectors.html"/> <item name="Database" href="database.html"/> <item name="Deployment" href="deployment.html" /> + <item name="Development" href="development.html" /> <item name="FDA Validation" href="fda-validation.html" /> <item name="How do I" href="http://wiki.apache.org/jakarta-tomcat/HowTo"/> <item name="Linux / Unix" href="unix.html"/> 1.1 jakarta-tomcat-site/xdocs-faq/development.xml Index: development.xml =================================================================== <?xml version="1.0"?> <!DOCTYPE document [ <!ENTITY project SYSTEM "project.xml"> ]> <document url="development.html"> &project; <properties> <author email="[EMAIL PROTECTED]">Mark Thomas</author> <title>Tomcat FAQ: Development</title> </properties> <body> <section name="Preface"> This section of the FAQ discusses common questions related to Tomcat development. </section> <section name="Questions"> <p> <ul> <li> <a href="#rd"> How do I configure Tomcat to support remote debugging? </a> </li> <li> <a href="#rd-eclipse"> How do I remotely debug Tomcat using Eclipse? </a> </li> <li> <a href="#rd-netbeans"> How do I remotely debug Tomcat using NetBeans? </a> </li> </ul> </p> </section> <section name="Answers"> <p> <question> <a name="rd">How do I configure Tomcat to support remote debugging?</a> </question> <answer> <p> The short answer is to add the following options when the JVM is started:<br/> <code>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</code><br/>
There are a number of ways you can do this depending on how you normally start Tomcat: <ul> <li>Set environment variables <code>JPDA_ADDRESS=8000</code> and <code>JPDA_TRANSPORT=dt_socket </code> and then start tomcat using <code>catalina jpda start</code>.</li> <li>If you run Tomcat using service wrapper, check the documentation for the service to determine how to set the required JVM options. </li> <li>If you start Tomcat from within an IDE, check the documentation for the IDE to determine how to set the required JVM options.</li> </ul> </p> <p>The port does not need to be set to 8000, it may be any value appropriate for your system.</p> <p>Whilst this is very useful in development it should not be used in production because of both security and performance implications.</p> </answer> <question> <a name="rd-eclipse">How do I remotely debug Tomcat using Eclipse?</a> </question> <answer> <p> This answer assumes that you have a project set up with all of the fixings and have some idea of what you're doing in this respect. If not then thats really outside the scope of this topic and more in the scope of you needing to go to <a href="http://www.eclipse.org">eclipse.org</a> and read up on how to use your ide, and maybe practice a little bit before you come back to this. We're also going to assume you have some idea of what a debugger is and how to use one. </p> <p> Make sure tomcat is started and that your app is deployed and the sources, etc are all defined as resources in your app. If you have a servlet or something, set a breakpoint where its sure to hit on the next request. Go to "Run->Debug...". Click on "Remote Java Applications", then click "New". Type in the title and all. Notice that port 8000 from the Tomcat instructions. Save and run. Eclipse will connect to the VM that Tomcat is running under. Wow, that was easy! Now go type the url to submit to your servlet or whatever in your browser. Boom you hit the breakpoint right? Have fun! </p> </answer> <question> <a name="rd-netbeans">How do I remotely debug Tomcat using NetBeans?</a> </question> <answer> <p> This answer assumes that you have a project set up with all of the fixings and have some idea of what you're doing in this respect. If not then thats really outside the scope of this topic and more in the scope of you needing to go to <a href="http://www.netbeans.org">netbeans.org</a> and read up on how to use your ide, and maybe practice a little bit before you come back to this. We're also going to assume you have some idea of what a debugger is and how to use one. </p> <p> Make sure tomcat is started and that your app is deployed and the sources, etc are all defined as resources in your app. If you have a servlet or something, set a breakpoint where its sure to hit on the next request. Go to "Debug->Start Session->Attach". A dialog should pop up and use following options: <ul> <li><strong>Debugger Type</strong>: Default Debugger (JPDA)</li> <li><strong>Connector</strong>: SocketAttach</li> <li><strong>Host</strong>: The ip address of the host your Tomcat installation is running on (127.0.0.1 if it is your machine).</li> <li><strong>Port</strong>: The port of your tomcat debugging interface, which should be 8000 if you've followed the instructions above.</li> </ul> </p> <p> Then press ok and you should have a debugging connection very similar to local debugging. (you can set breakpoints inspect variables etc.) </p> <p> Netbeans however has a second option, you can debug JSP files and servlets locally. Nothing really exciting happens there, an integrated Tomcat server is started and a remote connection is opened. Note however that the integrated Netbeans Tomcat usually is a few versions behind the current Jakarta/Apache version. </p> </answer> </p> </section> </body> </document> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]