cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger I Martin PhD" <>
Subject Re: Just starting COCOON
Date Sat, 19 Jan 2002 15:35:42 GMT
Understand that what you download from the apache Cocoon site is not a
software tool or IDE but a super-powered servlet with many illustrations of
how to use it, all in one huge example webapp (much beyond a typical "Hello
World!" example).  Your starting point is getting this one huge example web
app to deploy once or twice on tomcat by placing the cocoon.war file in the
webapps folder of tomcat.  The "as is" Cocoon installation either works or
it doesn't.  There is nothing you can do right or wrong. Especially for the
Current Version System CVS revision xml-cocoon2 from the jakarta site  My current tomcat revision is
Apache Tomcat/4.0.2-b1.  After I get a stable Cocoon revision running I use
it for a few months and back it up religiously when I go for the next cvs.
The command line:

 build.bat -Dinclude.webapp.libs=yes -Dinstall.war=%TOMCAT_HOME%\webapps

often will not work depending on the exact TOMCAT_HOME environment variable
you are using.  For example c:/Program Files/tomcat... has a space and can
cause age old problems.  Just copy the cocoon.war to the
%TOMCAT_HOME%\webapps yourself.  Fire tomcat up.  It either works or you got
a bum revision or copy of Cocoon.war. If it doesn't work the second time you
fire it up, delete the generated ...tomcat/work/localhost/cocoon and the
...tomcat/webapps/cocoon folders so that it has to deploy from the
cocoon.war file again.  May have to do this repeatedly until you rebuild
cocoon.war without hsqldb active or start making your own webapp
project(deployed through your own *.war file).  The problem is with the
hsqldb database example has a bug while shutting down.  The sooner that you
rebuild cocoon from its sources with
<hsqldb-server class="org.apache.cocoon.components.hsqldb.ServerImpl"
pool-max="1" pool-min="1">
<parameter name="port" value="9002"/>
<parameter name="silent" value="true"/>
<parameter name="trace" value="false"/>

commented out in the src/webapp/cocoon.xconf file, the better.  The the rest
of the examples will start and stop just find.  Note that some of the
examples need extra jars placed in the cocoon/lib folder such as jndi.jar,
phpsrvlt.jar, etc. The important thing is to get past flopping around in
this one huge example webapp and start your own serious webapp as soon as
possible after you see Cocoon's one huge example webapp run once or twice.

Cocoon is not a typically installed software package and so to apply it to
your own web app at first is not intuitive.  The documentation has a long
way to go to catch up; remember it is a work in progress and tends to assume
that we know the small but totally baffling how-to-get-started stuff.  I
finally discovered a cool way to do it and perhaps with editing from the
Cocoon 2 Team we can put together a "How to apply Cocoon 2" for their web
site.  The most important thing is to set up your own webapp project build
area.  This takes some work but you can do it in stages.  To start, create a
project folder(sibling to the xml-cocoon2 folder), name it according to your
project, prepare your directory structure:

        <all of the jars from your current working xml-cocoon2/lib folder>
        <plus the cocoon.jar from the xml-cocoon2/build/cocoon folder>
        //this is key because now your own build can be simplyfied
+->src //For your own custom additions to cocoon
    +->documentation //At first just a copy from the xml-cocoon2/src
            //You can eventually put your own or only things you need here
    +->java //Only your own custom code here.  No cocoon code because
                    cocoon.jar already has the compiled Cocoon classes.
    +->webapp    //At first a copy of the webapp from xml-cocoon2/src
                      //This you start modifying starting with the homepage
                      //and sitemap.xmap
                    //classpath appender
build.xml    //A stripped down or commented out revision from the one
                   //in the xml-cocoon2 folder.  Have it generate a build
                   // for construction of  your webapp jar and war files.
                    //set up your database initialization
                    //you will need to set somethings according to

Your custom webapp's build.xml can be pared down considerably from the huge
example cocoon webapp.  Until you make custom source code additions to your
...src/java folder you can disable the compile target.  Mostly you are
having it build the stuff it needs for your war file while applying build
variables such as

The next stage is studying the ...src/webapp/sitemap.xmap file and modify
the welcome pattern matching to something you know and want.  There is no
need to pare the sitemap.xmap file down; eventually you will need more and
more of it and anything not in immediate use just lies dormant.  Finding the
first welcome page can require some sleuthing.  Currently it is nearly half
way down sitemap.xmap and looks like:

<map:match pattern="">

<map:redirect-to uri="welcome"/>


<map:match pattern="welcome">

<map:generate src="docs/samples/samples.xml"/>


So ...src/webapp/docs/samples/samples.xml is the home page!  For those
familiar with Cocoon, this is no surprise but this was where I first started
to catch on!  What it meant to me is that I could start building my own
serious webapp now that I had the starting page and could study, modify
small parts of the whole to observe the changes that would occur after each
redeployment on tomcat.  I changed the welcome pattern matching to:
<map:match pattern="">

<map:redirect-to uri="welcome"/>


<map:match pattern="welcome">

<map:generate src="home.xml"/>

where home.xml is a stripped down ...src/webapp/docs/samples/samples.xml to
pieces pertinent to my serious webapp.  It depends at this point on what you
want your web app to do.  For me I already had a number of mysql databases I
wanted to display and administrate so I studied and pooled them up.
Then got into my own xsp development applying the esql.xsl stylesheet.
Studying xsl is very important for creating your own webapp's consistent
look and feel.  The consistent look and feel is maintained by the xsl
stylesheets and the formatted objects namespace
xmlns:fo="".  Only a few of the xsl
stylesheets in the one huge example cocoon webapp are sacred and those are
mostly in ...src/java.  Others such as
...src/webapp/stylesheets/page/simple-page2html.xsl you are encouraged to
modify, rename or replace (updating the sitemap.xmap pattern matching
required) in your webapp.  The power of Cocoon is that when you change a
presentation attribute or style, after the next build and deployment, your
entire website has the new look and feel consistently throughout it's pages.
After some up front hard work, web site maintainance becomes dynamic and
fun; not a mundane chore. Here we would need to branch into chapters; one
for each stylesheet or webapp segments goal?

This is Saturday morning, January 19 and I just couldn't focus on my
projects so I tried to help someone else instead. Those just starting keep
asking [specific] questions and those with more experience than me, please
revise this description of "How to apply Cocoon 2" or use anything from this
message if you find anything includable in the documentation.



----- Original Message -----
From: <>
To: <>
Sent: Friday, January 18, 2002 2:56 PM
Subject: RE: Just starting COCOON

> I have got to work but have a difficult time understanding. I tried some
> samples with devshed and could not get them to work.
> Sree
> x5178

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message