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ötz A new version has been created, state: publish Parts ===== Content ------- This part has been updated. Mime type: text/xml (unchanged) File name: (unchanged) Size: 6382 bytes (previous version: 1418 bytes) Content diff: <html> <body> <p>This tutorial describes how you can run Cocoon in debug mode in Eclipse. Make --- sure that you have a working Cocoon web application. This tutorial assumes that --- you have the <a href="daisy:1159">Your first Cocoon application using Maven --- 2</a> and the <a href="daisy:1297">Reloading classloader</a> tutorials --- completed.</p> +++ sure that you have a working Cocoon web application. These two tutorials </p> --- <h1>Step 1: Download Jetty 6</h1> +++ <ul> +++ <li><a href="daisy:1159">Your first Cocoon application using Maven 2</a></li> +++ <li><a href="daisy:1297">Reloading classloader</a></li> +++ </ul> --- <p>First, <a href="http://dist.codehaus.org/jetty/">download</a> Jetty 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 workspace. --- </p> +++ <p>help you to get one.</p> --- <p class="note">The instructions of this tutorial were tested with Jetty 6.0.2. --- </p> +++ <p class="note">This tutorial describes how the Jetty Launcher can be used to +++ run Cocoon. At the time of writing this, the Jetty Launcher doesn't support +++ Jetty 6. If you insist on using it, find some instructions in the "Using Jetty +++ 6" section.</p> --- <h1>Step 2: Configure Jetty</h1> +++ <h1>Using the Jetty Launcher</h1> --- <p>Copy <tt>./etc/jetty.xml</tt> to <tt>./etc/cocoon-debug.xml </tt>and make --- following changes:</p> +++ <ul> +++ <li>The <a href="http://jettylauncher.sourceforge.net/">Jetty Launcher</a> is an +++ Eclipse plugin that has to be installed. The best option is the +++ <a href="http://jettylauncher.sourceforge.net/updates">update link</a>.</li> +++ <li>After that, you have to download Jetty 5.1.x and extract it to a directory +++ of your choice.</li> +++ <li>Then follow the excellent +++ <a href="http://jettylauncher.sourceforge.net/docs/quickstart.html">Quick Start +++ guide</a> that comes with the Eclipse plugin.</li> +++ <ul> +++ <li>Note: Update <tt>./etc/webdefaults.xml</tt> and comment in the JSR154 +++ section as Cocoon makes use of it.</li> +++ </ul> --- <pre>...</pre> +++ </ul> --- <h1>Step 3: Load your projects into Eclipse</h1> +++ <p>If you want to be able to debug code that is in one of your libraries, you +++ either have to add the source code to the dependency (if you use Maven 2 try +++ <tt>mvn eclipse:eclipse -DdownloadSources</tt>) or if it is available as Eclipse +++ project, add it as <em>Project Reference</em> / <em>Java Build Path - +++ Project</em> reference. The second option together with the +++ <a href="daisy:1297">Reloading Classloader plugin</a>, makes it possible to work +++ in several projects while all changes take effect immediatly.</p> --- <h1>Step 4: Create an Eclipse project 'cocoon-debug' in your workspace</h1> +++ <h1>Using Jetty 6</h1> --- <p>[screenshot: new project]</p> +++ <p class="warn">Using the Jetty launcher is much simpler and you don't have to +++ create a Java project for each Cocoon application that you want to debug.</p> --- <p>[screenshot: set project dependencies]</p> +++ <p>If you insist on using Jetty 6, you can start Jetty as Java application from +++ within Eclipse. For this purpose</p> --- <p class="note">If available, the Maven Eclipse plugin can download the sources --- of the libraries your project depends on. For this purpose use the --- <tt>-DdownloadSources=true</tt> property: mvn <tt>eclipse:eclipse --- -DdownloadSources=true</tt></p> +++ <ul> +++ <li><a href="http://dist.codehaus.org/jetty/">download</a> Jetty 6</li> +++ <li>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 +++ workspace.</li> +++ <li>now create a new Java project (e.g. "Jetty6") in your workspace and add +++ jetty-6.x.jar, jetty-util-6.x.jar, servlet-api.2.5.x.jar and start.jar as +++ library dependencies (all 4 files are part of the official Jetty distribution) +++ </li> +++ <li>add the project(s) that you want to debug as <em>Project References</em> +++ and as <em>Java Build Path - Projects</em> references. This makes it necessary +++ that these projects are added to the current workspace.</li> +++ <li>provide a minimal Jetty configuration file <tt>jetty-debug-cocoon.xml</tt>, +++ e.g. in the root directory of your "Jetty6" project</li> +++ </ul> --- <h1>Step 5: Create debugging configuration in Eclipse</h1> +++ <pre><?xml version="1.0"?> +++ <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> +++ <Configure id="Server" class="org.mortbay.jetty.Server"> +++ <Set name="ThreadPool"> +++ <New class="org.mortbay.thread.BoundedThreadPool"> +++ <Set name="minThreads">2</Set> +++ <Set name="lowThreads">2</Set> +++ <Set name="maxThreads">10</Set> +++ </New> +++ </Set> +++ <Call name="addConnector"> +++ <Arg> +++ <New class="org.mortbay.jetty.nio.SelectChannelConnector"> +++ <Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set> +++ <Set name="maxIdleTime">30000</Set> +++ <Set name="Acceptors">2</Set> +++ <Set name="confidentialPort">8443</Set> +++ </New> +++ </Arg> +++ </Call> +++ <Set name="handler"> +++ <New id="handlers" class="org.mortbay.jetty.handler.HandlerCollection"> +++ <Set name="handlers"> +++ <Array type="org.mortbay.jetty.Handler"> +++ <Item> +++ <New id="contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/> +++ </Item> +++ <Item> +++ <New id="defaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/> +++ </Item> +++ <Item> +++ <New id="requestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/> +++ </Item> +++ </Array> +++ </Set> +++ </New> +++ </Set> +++ <New id="cocoon" class="org.mortbay.jetty.webapp.WebAppContext"> +++ <Arg><Ref id="contexts"/></Arg> +++ <Arg><strong>[path to the webapp root directory]</strong></Arg> +++ <Arg>/</Arg> +++ </New> --- <h1>Step 6: Start debugging</h1> +++ <!-- =========================================================== --> +++ <!-- extra options --> +++ <!-- =========================================================== --> +++ <Set name="stopAtShutdown">true</Set> +++ <!-- ensure/prevent Server: header being sent to browsers --> +++ <Set name="sendServerVersion">true</Set> +++ </Configure></pre> +++ +++ <ul> +++ <li>open "Run - Debug" and add a new Java Application as debugging target</li> +++ <ul> +++ <li>name it e.g. "Debugging Cocoon"</li> +++ </ul> +++ +++ <ul> +++ <li>select the new project as <em>Project</em></li> +++ <li>select org.mortbay.start.Main as <em>Main class </em>(check "<em>Include +++ libraries when searching for a main class</em>")</li> +++ <li>add <tt>jetty-debug-cocoon.xml </tt>as <em>Programm argument</em></li> +++ <li>add +++ <tt>-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog +++ -Dorg.apache.cocoon.mode=dev</tt> as <em>VM Arguments</em></li> +++ </ul> +++ +++ <li>hit the <em>Debug</em> button</li> +++ <li>open http://localhost:8080/[block-name] in your favorite web browser</li> +++ </ul> +++ </body> </html>