cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Updated: Debugging Cocoon in Eclipse
Date Mon, 01 Jan 2007 15:53:58 GMT
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>&lt;?xml version="1.0"?&gt;
+++ &lt;!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"&gt;
+++ &lt;Configure id="Server" class="org.mortbay.jetty.Server"&gt;
+++     &lt;Set name="ThreadPool"&gt;
+++       &lt;New class="org.mortbay.thread.BoundedThreadPool"&gt;
+++         &lt;Set name="minThreads"&gt;2&lt;/Set&gt;
+++         &lt;Set name="lowThreads"&gt;2&lt;/Set&gt;
+++         &lt;Set name="maxThreads"&gt;10&lt;/Set&gt;
+++       &lt;/New&gt;
+++     &lt;/Set&gt;
+++     &lt;Call name="addConnector"&gt;
+++       &lt;Arg&gt;
+++           &lt;New class="org.mortbay.jetty.nio.SelectChannelConnector"&gt;
+++             &lt;Set name="port"&gt;&lt;SystemProperty name="jetty.port"
default="8080"/&gt;&lt;/Set&gt;
+++             &lt;Set name="maxIdleTime"&gt;30000&lt;/Set&gt;
+++             &lt;Set name="Acceptors"&gt;2&lt;/Set&gt;
+++             &lt;Set name="confidentialPort"&gt;8443&lt;/Set&gt;
+++           &lt;/New&gt;
+++       &lt;/Arg&gt;
+++     &lt;/Call&gt;
+++     &lt;Set name="handler"&gt;
+++       &lt;New id="handlers" class="org.mortbay.jetty.handler.HandlerCollection"&gt;
+++         &lt;Set name="handlers"&gt;
+++          &lt;Array type="org.mortbay.jetty.Handler"&gt;
+++            &lt;Item&gt;
+++              &lt;New id="contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/&gt;
+++            &lt;/Item&gt;
+++            &lt;Item&gt;
+++              &lt;New id="defaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/&gt;
+++            &lt;/Item&gt;
+++            &lt;Item&gt;
+++              &lt;New id="requestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/&gt;
+++            &lt;/Item&gt;
+++          &lt;/Array&gt;
+++         &lt;/Set&gt;
+++       &lt;/New&gt;
+++     &lt;/Set&gt; 
+++     &lt;New id="cocoon" class="org.mortbay.jetty.webapp.WebAppContext"&gt;
+++       &lt;Arg&gt;&lt;Ref id="contexts"/&gt;&lt;/Arg&gt;
+++       &lt;Arg&gt;<strong>[path to the webapp root directory]</strong>&lt;/Arg&gt;
+++       &lt;Arg&gt;/&lt;/Arg&gt;
+++     &lt;/New&gt;
    
--- <h1>Step 6: Start debugging</h1>
+++     &lt;!-- =========================================================== --&gt;
+++     &lt;!-- extra options                                              
--&gt;
+++     &lt;!-- =========================================================== --&gt;
+++     &lt;Set name="stopAtShutdown"&gt;true&lt;/Set&gt;
+++     &lt;!-- ensure/prevent Server: header being sent to browsers       
--&gt;
+++     &lt;Set name="sendServerVersion"&gt;true&lt;/Set&gt;
    
+++ &lt;/Configure&gt;</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>


Mime
View raw message