Return-Path: Delivered-To: apmail-cocoon-docs-archive@www.apache.org Received: (qmail 76472 invoked from network); 1 Jan 2007 15:54:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Jan 2007 15:54:19 -0000 Received: (qmail 63841 invoked by uid 500); 1 Jan 2007 15:54:26 -0000 Delivered-To: apmail-cocoon-docs-archive@cocoon.apache.org Received: (qmail 63809 invoked by uid 500); 1 Jan 2007 15:54:25 -0000 Mailing-List: contact docs-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: docs@cocoon.apache.org List-Id: Delivered-To: mailing list docs@cocoon.apache.org Received: (qmail 63798 invoked by uid 99); 1 Jan 2007 15:54:25 -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 [140.211.11.67] (HELO cocoon.zones.apache.org) (140.211.11.67) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Jan 2007 07:54:25 -0800 Message-ID: <4938710.1167666838075.JavaMail.daisy@cocoon.zones.apache.org> Date: Mon, 1 Jan 2007 15:53:58 +0000 (GMT+00:00) From: daisy@cocoon.zones.apache.org To: docs@cocoon.apache.org Subject: [DAISY] Updated: Debugging Cocoon in Eclipse Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org A document has been updated: http://cocoon.zones.apache.org/daisy/documentation/1301.html Document ID: 1301 Branch: main Language: default Name: Debugging Cocoon in Eclipse (unchanged) Document Type: Cocoon Document (unchanged) Updated on: 1/1/07 3:53:46 PM Updated by: Reinhard P=C3=B6tz A new version has been created, state: publish Parts =3D=3D=3D=3D=3D Content ------- This part has been updated. Mime type: text/xml (unchanged) File name: (unchanged) Size: 6382 bytes (previous version: 1418 bytes) Content diff: =20

This tutorial describes how you can run Cocoon in debug mode in Ecli= pse. Make --- sure that you have a working Cocoon web application. This tutorial assu= mes that --- you have the=C2=A0 Your first Cocoon application= using Maven --- 2 and the Reloading classloader tutorial= s --- completed.

+++ sure that you have a working Cocoon web application. These two tutorial= s=C2=A0

=20 ---

Step 1: Download Jetty 6

+++ =20 ---

First, download Jett= y 6 and --- extract it into a directory of choice. You only have to make sure that = it is not --- a subdirectory of an Eclipse project that is added to your Eclispe work= space. ---

+++

help you to get one.

=20 ---

The instructions of this tutorial were tested with Je= tty 6.0.2. ---

+++

This tutorial describes how the Jetty Launcher can be= used to +++ run Cocoon. At the time of writing this, the Jetty Launcher doesn't sup= port +++ Jetty 6. If you insist on using it, find some instructions in the "Usin= g Jetty +++ 6" section.

=20 ---

Step 2: Configure Jetty

+++

Using the Jetty Launcher

=20 ---

Copy ./etc/jetty.xml to ./etc/cocoon-debug.xml and= make --- following changes:

+++ =20 ---

Step 3: Load your projects into Eclipse

+++

If you want to be able to debug code that is in one of your librarie= s,=C2=A0 you +++ either have to add the source code to the dependency (if you use Maven = 2 try +++ mvn eclipse:eclipse -DdownloadSources) or if it is available a= s Eclipse +++ project, add it as Project Reference / Java Build Path - +++ Project reference. The second option together with the +++ Reloading Classloader plugin, makes it possi= ble to work +++ in several projects while all changes take effect immediatly.

=20 ---

Step 4: Create an Eclipse project 'cocoon-debug' in your workspace<= /h1> +++

Using Jetty 6

=20 ---

[screenshot: new project]

+++

Using the Jetty launcher is much simpler=C2=A0 and yo= u don't have to +++ create a Java project for each Cocoon application that you want to debu= g.

=20 ---

[screenshot: set project dependencies]

+++

If you insist on using Jetty 6, you can start Jetty as Java applicat= ion from +++ within Eclipse. For this purpose

=20 ---

If available, the Maven Eclipse plugin can download t= he sources --- of the libraries your project depends on. For this purpose use the --- -DdownloadSources=3Dtrue property: mvn eclipse:eclipse --- -DdownloadSources=3Dtrue

+++
    +++
  • download Jetty 6 +++
  • and extract it into a directory of choice. You only have to make su= re that +++ it is not a subdirectory of an Eclipse project that is added to your Ec= lispe +++ workspace.
  • +++
  • now create a new Java project (e.g. "Jetty6") in your workspace and= add +++ jetty-6.x.jar, jetty-util-6.x.jar,=C2=A0 servlet-api.2.5.x.jar and star= t.jar as +++ library dependencies (all 4 files are part of the official Jetty distri= bution) +++
  • +++
  • add the project(s) that you want to debug as Project References= +++ and as Java Build Path - Projects references. This makes it ne= cessary +++ that these projects are added to the current workspace.
  • +++
  • provide a minimal Jetty configuration file jetty-debug-cocoon.x= ml, +++ e.g. in the root directory of your "Jetty6" project
  • +++
=20 ---

Step 5: Create debugging configuration in Eclipse

+++
<?xml version=3D"1.0"?>
+++ <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//E=
N" "http://jetty.mortbay.org/configure.dtd">
+++ <Configure id=3D"Server" class=3D"org.mortbay.jetty.Server">
+++ =C2=A0=C2=A0=C2=A0 <Set name=3D"ThreadPool">
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <New class=3D"org.mortbay.thread.Boun=
dedThreadPool">
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Set name=3D"minThreads"&=
gt;2</Set>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Set name=3D"lowThreads"&=
gt;2</Set>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Set name=3D"maxThreads"&=
gt;10</Set>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </New>
+++ =C2=A0=C2=A0=C2=A0 </Set>
+++ =C2=A0=C2=A0=C2=A0 <Call name=3D"addConnector">
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Arg>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <New class=3D=
"org.mortbay.jetty.nio.SelectChannelConnector">
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <=
Set name=3D"port"><SystemProperty name=3D"jetty.port" default=3D"8080=
"/></Set>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <=
Set name=3D"maxIdleTime">30000</Set>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <=
Set name=3D"Acceptors">2</Set>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <=
Set name=3D"confidentialPort">8443</Set>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </New>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </Arg>
+++ =C2=A0=C2=A0=C2=A0 </Call>
+++ =C2=A0=C2=A0=C2=A0 <Set name=3D"handler">
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <New id=3D"handlers" class=3D"org.mor=
tbay.jetty.handler.HandlerCollection">
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Set name=3D"handlers">=
;
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Array type=3D"org.=
mortbay.jetty.Handler">
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Item&g=
t;
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 <New id=3D"contexts" class=3D"org.mortbay.jetty.handler.ContextHandl=
erCollection"/>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </Item&=
gt;
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Item&g=
t;
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 <New id=3D"defaultHandler" class=3D"org.mortbay.jetty.handler.Defaul=
tHandler"/>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </Item&=
gt;
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Item&g=
t;
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 <New id=3D"requestLog" class=3D"org.mortbay.jetty.handler.RequestLog=
Handler"/>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </Item&=
gt;
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </Array>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </Set>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </New>
+++ =C2=A0=C2=A0=C2=A0 </Set>=20
+++ =C2=A0=C2=A0=C2=A0 <New id=3D"cocoon" class=3D"org.mortbay.jetty.web=
app.WebAppContext">
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Arg><Ref id=3D"contexts"/>&=
lt;/Arg>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Arg>[path to the webapp r=
oot directory]</Arg>
+++ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Arg>/</Arg>
+++ =C2=A0=C2=A0=C2=A0 </New>
   =20
--- 

Step 6: Start debugging

+++ =C2=A0=C2=A0=C2=A0 <!-- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --> +++ =C2=A0=C2=A0=C2=A0 <!-- extra options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 --> +++ =C2=A0=C2=A0=C2=A0 <!-- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --> +++ =C2=A0=C2=A0=C2=A0 <Set name=3D"stopAtShutdown">true</Set> +++ =C2=A0=C2=A0=C2=A0 <!-- ensure/prevent Server: header being sent to = browsers=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 --> +++ =C2=A0=C2=A0=C2=A0 <Set name=3D"sendServerVersion">true</Set&g= t; =20 +++ </Configure>
+++=20 +++
    +++
  • open "Run - Debug" and add a new Java Application as debugging targ= et
  • +++
      +++
    • name it e.g. "Debugging Cocoon"
    • +++
    +++=20 +++
      +++
    • select the new project as Project
    • +++
    • select org.mortbay.start.Main as Main class (check "In= clude +++ libraries when searching for a main class")
    • +++
    • add jetty-debug-cocoon.xml as Programm argument +++
    • add +++ -Dorg.apache.commons.logging.Log=3Dorg.apache.commons.logging.impl.= SimpleLog +++ -Dorg.apache.cocoon.mode=3Ddev as VM Arguments
    • +++
    +++=20 +++
  • hit the Debug button
  • +++
  • open http://localhost:8080/[block-name] in your favorite web browse= r
  • +++
+++=20