You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Gavin Carothers <ga...@versionthis.com> on 2006/06/28 23:18:39 UTC
Creating a Block in Trunk, or Using Cocoon 2.2 Part I
To the Community:
Shall I keep up the blow by blow over the next few days or not? It
seems to be me that people have been questioning if they can adopt
2.2 for use in their applications or not. Personally I just want to
try and see what happens and I thought others might want to see what
it's like. At the end of this process I hope to come up with
something a bit more organized as well.
Using Cocoon-2.2
Project Scope:
Simple ReST style wrapper to an eXist database.
Admin UI for eXist database.
XSLT pipeline ending in XEP/FOP FO to PDF serializer
Currently written as a Cocoon-2.1.8 application. The application is
being repurposed for a larger project and needs to be re-factored and
as I have something working (the 2.1.8 app) that I can test the front
end application vs I have enough time to try out Cocoon 2.2. The
2.1.8 application uses a few blocks directly.
Blocks:
webdav
javaflow
fop
All other dependancies and required blocks are indirect. As the Admin
UI has not been written yet there is no template or forms block.
Wednesday, June 28th
svn co http://svn.apache.org/repos/asf/cocoon/tunk
mvn clean install
--build failure in
org.apache.cocoon.components.expression.jexl.JexlTestCase --
Well, I'm not using jexl... yet. Lets see if we can't keep going.
mvn install -Dmaven.test.skip=true
encountered 1 download failure and reran
tahdah! a war! and the Cocoon 2.2 Webapp Archetype have been built!
mvn cocoon:deploy
Question: is there a way to get maven2 to stop checking for updates
from the remote repos and just use what I have installed?
Answer: mvn -o
result of quick non exhaustive test:
AJAX samples don't work so good
Flow samples work fine
Good enough to be going on with. Time to create a webapp.
mvn archetype:create -DarchetypeArtifactId=cocoon-22-archetype-webapp
-DgroupId=com.amesondemand.bookbuild -DartifactId=tocmanager -
DarchetypeGroupId=org.apache.cocoon -DarchetypeVersion=1.0.0-SNAPSHOT
mvn cocoon:deploy
mvn jetty6:run
Embedded error:
org.apache.avalon.framework.configuration.ConfigurationException:
Unable to read configurations from context://WEB-INF/sitemap-additions
Hrm, very close now... huh, my sitemap from src isn't being used at
all that's strange. Okay, lets see the docs again. Oh! Shouldn't be
creating a "webapp" I guess, trying to create block now.
mvn archetype:create -DarchetypeArtifactId=cocoon-22-archetype-block -
DgroupId=com.amesondemand.bookbuild -DartifactId=toc-manager -
DarchetypeGroupId=org.apache.cocoon -DarchetypeVersion=1.0.0-SNAPSHOT
Okay... interesting poms are rather similar, other then
<dependency>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-forms-impl</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
vs
<dependency>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-template-impl</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
however the source code layout is very different, rather then webapp
we now have COB-INF and some demo spring code. Googling COB-INF
assures me it has something to do with cocoon but no real idea what
it is. Remember back to earlier conversions on the mailing list I
think this is the chosen location for all cocoon configuration files
in 2.2. That makes sense. Onward!
mvn -o cocoon:deploy
ah, nifty I get the same rapid deployment method I used to as the
whole of COB-INF is mounted in the generated sitemap.xmap. This seems
to be going much better then the "webapp" archetype, I can understand
what's going on here for the most part. I haven't a clue how at some
point I'm supposed to get a WAR out of this but that can wait. Lets
see if I can start jetty and start writing some code!
mvn -o jetty6:run
bugger... that almost worked.
Embedded error:
org.springframework.beans.factory.BeanDefinitionStoreException:
Unexpected exception parsing XML document from resource loaded from
byte array; nested exception is
org.springframework.beans.factory.BeanDefinitionStoreException: Line
18 in XML document from URL [file:/Users/gcarothers/Documents/
Programing/toc-manager/src/main/resources/META-INF/spring/demo-
application-context.xml] is invalid; nested exception is
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration
of element 'beans'.
Wait! I just saw cziegeler's post an hour or two ago about spring in
cocoon.
http://www.osoco.org/archives/2006/06/cocoon_is_using.html
NetNewsWire saves the day! Well I can't easily change the version of
spring to depend on as that seems likely to break stuff and is a bit
more involved then I want to get. So, lets see if removing the
license works.
Victory! Cocoon is running!
short-lived...
No default type exists for 'map:pipeline' at file:/Users/gcarothers/
Documents/Programing/toc-manager/target/toc-manager/sitemap.xmap:23:19
I remember this being fixed I thought back in February, at least I
thought I did. Oh well, try more in the morning.
Conclusions after Day 1 of Cocoon 2.2:
Hot spit, maven2 works with cocoon. Even with all the nasty stuff
I've run into so far the build process has... sadly... saved me time
over when I started using cocoon back with 2.1.3. The documentation
in a few places on daisy is slightly out of date with what's in
trunk. All in all it's MUCH nicer to work with 2.2 then it is with
2.1... of course I haven't managed to run code yet ;)
Re: Creating a Block in Trunk, or Using Cocoon 2.2 Part I
Posted by Carsten Ziegeler <cz...@apache.org>.
Bertrand Delacretaz wrote:
> On 6/28/06, Gavin Carothers <ga...@versionthis.com> wrote:
>
>> ...At the end of this process I hope to come up with
>> something a bit more organized as well....
>
> Thanks for sharing your experiences!
>
> Note that we have started a similar effort in the whiteboard, an
> improved port of the Bricks example, currently at
> http://svn.apache.org/repos/asf/cocoon/whiteboard/example-apps/bricks-archetype/
>
> Once this works, the idea is to convert it to a Maven archetype so
> that people can quickly see how to build apps on 2.2.
>
> I have just created http://issues.apache.org/jira/browse/COCOON-1874
> to follow this.
>
> Anyone willing to join in is welcome, of course!
>
> And alternate "getting to grips with 2.2" stories are welcome of course.
>
I started to document some of the new features in Daisy. There is a new
document about configuration and so on. These docs do not cover
everything yet, but it's a good starting point.
I think we should do some marketing when we do a release next week -
those of us who where yesterday at Sally's session will know what I mean :)
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: Creating a Block in Trunk, or Using Cocoon 2.2 Part I
Posted by Bertrand Delacretaz <bd...@apache.org>.
On 6/28/06, Gavin Carothers <ga...@versionthis.com> wrote:
> ...At the end of this process I hope to come up with
> something a bit more organized as well....
Thanks for sharing your experiences!
Note that we have started a similar effort in the whiteboard, an
improved port of the Bricks example, currently at
http://svn.apache.org/repos/asf/cocoon/whiteboard/example-apps/bricks-archetype/
Once this works, the idea is to convert it to a Maven archetype so
that people can quickly see how to build apps on 2.2.
I have just created http://issues.apache.org/jira/browse/COCOON-1874
to follow this.
Anyone willing to join in is welcome, of course!
And alternate "getting to grips with 2.2" stories are welcome of course.
-Bertrand
Re: Creating a Block in Trunk, or Using Cocoon 2.2 Part I
Posted by hepabolu <he...@gmail.com>.
Gavin Carothers said the following on 28/6/06 23:18:
> To the Community:
>
> Shall I keep up the blow by blow over the next few days or not? It seems
> to be me that people have been questioning if they can adopt 2.2 for use
> in their applications or not. Personally I just want to try and see what
> happens and I thought others might want to see what it's like. At the
> end of this process I hope to come up with something a bit more
> organized as well.
Hi Gavin,
this is great stuff. Thanks for the effort, I'm looking forward to the
next posts.
I'd like to put this somewhere more in focus, daisy docs e.g. It
provides an excellent stepwise intro for 2.2 beginners.
If you agree, I could put your "installments" in Daisy, but it would be
nice if you could do a bit more explicit referencing. Examples:
- "looking in the docs", please add a link
- "docs are somewhat outdated", I know 2.2 is moving target, but if you
could point more specifically to the outdated parts, they can be fixed
or marked with a warning.
Bye, Helma
Re: Making a Block Run in Trunk, or Using Cocoon 2.2 Part II
Posted by Reinhard Poetz <re...@apache.org>.
Gavin Carothers wrote:
> Questions and Answers from Part I:
>
> "looking in the docs"
>
> http://cocoon.zones.apache.org/daisy/documentation/g1/1159.html
> refers to creating a block, but uses the cocoon-22-archetype-webapp
>
> http://cocoon.zones.apache.org/daisy/documentation/g1/756.html
> refers to a very strange archetype that happily no longer seems to exist
>
> http://svn.apache.org/repos/asf/cocoon/whiteboard/example-apps/bricks-
> archetype/
> SEEMS to be based on the "webapp" archetype.
>
> http://cocoon.zones.apache.org/daisy/documentation/863/g1/796.html
> refers to creating a block, and as it's under the block deployer this
> makes sense. The reason I ended up using the block archetype rather
> then webapp was simply that it seemed to be working.
Gavin,
correcting the docs is on the top of my todo list and I should find some time
this evening/tommorrow to make all the referred docs consistent.
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
Re: Making a Block Run in Trunk, or Using Cocoon 2.2 Part II
Posted by Reinhard Poetz <re...@apache.org>.
Gavin Carothers wrote:
> Questions and Answers from Part I:
>
> "looking in the docs"
>
> http://cocoon.zones.apache.org/daisy/documentation/g1/1159.html
> refers to creating a block, but uses the cocoon-22-archetype-webapp
fixed now
Do the given explanations work for you?
> http://cocoon.zones.apache.org/daisy/documentation/g1/756.html
> refers to a very strange archetype that happily no longer seems to exist
I fixed this too
> http://svn.apache.org/repos/asf/cocoon/whiteboard/example-apps/bricks-
> archetype/
> SEEMS to be based on the "webapp" archetype.
Bertrand and Andrew have begun to make the bricks demo a Cocoon block.
> http://cocoon.zones.apache.org/daisy/documentation/863/g1/796.html
> refers to creating a block, and as it's under the block deployer this
> makes sense. The reason I ended up using the block archetype rather
> then webapp was simply that it seemed to be working.
I was working on the block archetype and the block deployer over the last days
and both are working for me now.
I hope that I find some time very soon to add more documentation about how to
use Cocoon 2.2.
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
Making a Block Run in Trunk, or Using Cocoon 2.2 Part II
Posted by Gavin Carothers <ga...@versionthis.com>.
Questions and Answers from Part I:
"looking in the docs"
http://cocoon.zones.apache.org/daisy/documentation/g1/1159.html
refers to creating a block, but uses the cocoon-22-archetype-webapp
http://cocoon.zones.apache.org/daisy/documentation/g1/756.html
refers to a very strange archetype that happily no longer seems to exist
http://svn.apache.org/repos/asf/cocoon/whiteboard/example-apps/bricks-
archetype/
SEEMS to be based on the "webapp" archetype.
http://cocoon.zones.apache.org/daisy/documentation/863/g1/796.html
refers to creating a block, and as it's under the block deployer this
makes sense. The reason I ended up using the block archetype rather
then webapp was simply that it seemed to be working.
Thursday, June 29th:
Based on messages from the mailing list, this morning begin with:
svn up
mvn install
Oops, org.apache.cocoon.template.jxtg.JXTemplateGeneratorTestCase and
org.apache.cocoon.environment.FOMTestCase still fail.
mvn install -Dmaven.test.skip=true
Starting back were we ended yesterday. We have the archetype block
created and want to see if the pipeline it deploys works.
mvn cocoon:deploy
mvn jetty6:run
Opening up Firefox and trying http://localhost:8888/toc-manager/ No
luck.
No default type exists for 'map:pipeline' at file:/Users/gcarothers/
Documents/Programing/toc-manager/target/toc-manager/sitemap.xmap:26:19
Okay, so some part of the configuration is likely screwed up. Lets go
back to February when I last remember seeing this issue mentioned on
the mailing list.
Ben Popes comment on adding dependencies causing the error gives us
the best chance for fixing this quickly.
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=114082894919896&w=2
removing
<dependency>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-template-impl</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
from the pom.xml, finding no blocks.xml or other place where
dependencies are referenced in COB-INF we will try cleaning and
deploying again.
mvn clean cocoon:deploy
mvn jetty6:run
Opening up Firefox and trying http://localhost:8888/toc-manager/ No
luck.
No default type exists for 'map:pipeline' at file:/Users/gcarothers/
Documents/Programing/toc-manager/target/toc-manager/sitemap.xmap:23:19
There is another <beans/> file in cocoon-core-applicationContext.xml
lets see what removing it's license header does.
Nope.
Okay, lets look into the issues from February a bit more deeply.
Well, http://marc.theaimsgroup.com/?l=xml-cocoon-
dev&m=114089107113280&w=2 seems to mean that this got solved for
cocoon-webapp, that's good. So lets take a look at that application
since it works.
First thing we notice is this application has a META-INF directory
which upon first inspection mentions spring, closer examination
revels that this is used by OSGi and not the normal cocoon-block-
deployer, so we can move on from here.
There seems to be a lot of stuff in here for the samples, being a
demo application. We don't really want to deal with getting the
samples to work at the moment we want to know why this webapp works
and toc-manager doesn't. So going to remove the dependencies on the
sample blocks. Simplify what we're building, and hope it still works.
Upon removing those we find one other dependency left:
<dependency>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-deployer-plugin-demo</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
mvn clean cocoon:deploy jetty6:run
Well now, we have a running application without all the samples, in
fact without much of anything. Excellent, lets see what's going on in
the target/cocoon-webapp/ directory and compare that to our target/
toc-manager. Well, there we go. toc-manager's target webapp does not
have a cocoon-core-sitemap.xmap, so no pipelines nor any of the other
main components are every configured. In fact our block has no WEB-
INF at all... hrm. Now clearly some of the items from COB-INF end up -
in- the deployed WEB-INF but as I don't yet understand how that
process works nor have I found documentation on it we are going to
cheat. As this comes from the src/ directory and not from any
dependency we will simply copy over the whole of WEB-INF into the
src/ tree of toc-manager and see what happens.
cd toc-manager
mvn -o clean cocoon:deploy jetty6:run
Heh, as one might guess this did nothing. In fact none of the
contents of WEB-INF was copied into target at all. Manually coping
the cocoon-core-sitemap.xmap into target/ causes everything to work!
We are running code!
minimac:~ gcarothers$ curl http://localhost:8888/toc-manager/
<?xml version="1.0" encoding="ISO-8859-1"?>
<demo>
<module>com.amesondemand.bookbuild:toc-manager</module>
<spring>This is a message coming from a Spring bean.</spring>
</demo>
So, now how do we get cocoon-core-sitemap.xmap into our block? We
could keep copying it by hand, but that's not much fun. We could add
it to our block and then to the block archetype as well, or we can
add it too cocoon-core. I've taken that last of these options locally.
cocoon-2.2-dev/core/cocoon-core/src/main/resources/META-INF/legacy/
sitemap-additions/cocoon-core-sitemap.xmap has been added. I honestly
don't know where this should go. But leaving it only in cocoon-webapp
strikes me as wrong.
Conclusions from Day 2:
It works! It works! Clearly the next steps are to add blocks but the
sample demo code is running in my own archetype created block. Adding
my own pipelines and flowscript from here should be reasonably simple.
Sadly the rest of my day will be taken up with meetings and
preperations for meetings. So I leave you all with this till tomorrow.
Cheers,
Gavin
Re: Creating a Block in Trunk, or Using Cocoon 2.2 Part I
Posted by Andrew Savory <an...@luminas.co.uk>.
Hi Gavin,
Gavin Carothers wrote:
> Shall I keep up the blow by blow over the next few days or not?
This is excellent! Please do keep it up.
> result of quick non exhaustive test:
> AJAX samples don't work so good
Maurizio fixed this yesterday and Simone committed it, the samples
should now work properly.
Thanks,
Andrew.
--
Andrew Savory, Managing Director, Luminas Limited
Tel: +44 (0)870 741 6658 Fax: +44 (0)700 598 1135
Web: http://www.luminas.co.uk/
Orixo alliance: http://www.orixo.com/