Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 25023 invoked from network); 18 Nov 2005 04:27:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Nov 2005 04:27:52 -0000 Received: (qmail 25400 invoked by uid 500); 18 Nov 2005 04:20:49 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 20453 invoked by uid 500); 18 Nov 2005 04:18:09 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 18832 invoked by uid 99); 18 Nov 2005 04:17:15 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 17 Nov 2005 20:15:25 -0800 Received: (qmail 7475 invoked by uid 65534); 18 Nov 2005 04:15:04 -0000 Message-ID: <20051118041504.7474.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r345438 [47/286] - in /cocoon/site/site/2.1: ./ developing/ developing/portal/ developing/portal/coplets/ developing/webapps/ developing/webapps/authentication/ faq/ howto/ installing/ plan/ plan/documentation/ plan/otherplanning/ plan/over... Date: Fri, 18 Nov 2005 04:13:22 -0000 To: cvs@cocoon.apache.org From: crossley@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: cocoon/site/site/2.1/faq/faq-debugging.html URL: http://svn.apache.org/viewcvs/cocoon/site/site/2.1/faq/faq-debugging.html?rev=345438&view=auto ============================================================================== --- cocoon/site/site/2.1/faq/faq-debugging.html (added) +++ cocoon/site/site/2.1/faq/faq-debugging.html Thu Nov 17 20:00:02 2005 @@ -0,0 +1,1334 @@ + + + + + + + +Debugging FAQs + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + +
+
+
+
+ +
+ + +
+ +
+ +   +
+ + + + + +
+

Debugging FAQs

+ +

+
+

How do I debug Cocoon using JDK1.3+?

+

With JDK1.3 or above, first set the CATALINA_OPTS (for Tomcat 4.x as +shown below (on Win2K).

+
set CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE
+    -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
+
+
+
Note
+
For Tomcat 3.x the param is TOMCAT_OPTS and the first value is +-classic instead of -server.
+
+

Add it to the catalina.bat, that can be found in +%TOMCAT_HOME%\bin\, right after the first rem section.
+The same information in more detail can be found at +Setting up Tomcat +for Remote Debugging.

+

The problem of this approach is the blocking of using Tomcat in another mode. +You always have to touch catalina.bat again when changing the mode and +this file is really a batch beast, isn't it? Furthermore catalina.bat +is only a starting mode library and should not be touched by hand IMO.
+Let me propose my approach: Go to the last line of startup.bat where +catalina.bat is called. Replace

+
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
+

with

+
set JPDA_TRANSPORT=dt_socket
+set JPDA_ADDRESS=8000
+call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
+      
+

A switch can now be done by adding and removing jpda. You can also +place the old line in comments and switch between them. Or you copy +startup.bat to debug.bat and do the changes there.

+
+
Note
+
Note that Tomcat must be started using startup.bat in +order to set these values; if you are using "java.exe -jar ...bootstrap.jar +start" or anything similar to start Tomcat, you have to set the +CATALINA_OPTS on the commandline or for Windows in general.
+
+
+
Note
+
If you use Jetty included with Cocoon 2.1 it's much easier. +Instead of doing "cocoon.bat servlet" you simply call "cocoon.bat +servlet-debug".
+
+

After having started Tomcat or the servlet container of your choice in remote +debugging mode, attach the debugger to localhost:8000 using "jdb -attach +myhost:8000". If you get an error "Error accessing shared memory, rc = +-1", try "jdb -connect com.sun.jdi.SocketAttach:port=8000" +instead.
+More information on this can be found in the + JPDA +documentation.

+
+
Note
+
The attaching of the debugger to that port can be done very +easily in almost all modern IDEs as Eclipse, IDEA, NetBeans or JBuilder. Mostly +port 8000 and dt_socket are preselected.
+
+

Now that I have prepared Tomcat and my IDE for debugging: How do I debug? +

+

Of course we can not give to many details here as it might be different for +all the possible IDEs out there, but the general proceeding should be the same. +The following steps are for jdb, it should be much easier for the IDEs.
+1. Set a breakpoint in a class via "stop in +org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.checkPipeline". +
+2. Enter a URL in your browser to get Cocoon to do the stuff that needs +debugging. When your breakpoint is hit, you'll get the message in jdb:
+ +Breakpoint hit: "thread=Thread-11", +org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.checkPipeline(), +line=363 bci=0.
+3. Use the debugger commands "print", "next", and "cont" to examine the data and +step through the code.

+ +
+
+ +
 
+
+ + + Propchange: cocoon/site/site/2.1/faq/faq-debugging.html ------------------------------------------------------------------------------ svn:eol-style = native